Get compile type within code (debug/release) ?
Blitz3D Forums/Blitz3D Beginners Area/Get compile type within code (debug/release) ?
| ||
Hi all, Is it possible to know programatically if we are compiled for release or debug? I know I can set a const or global 'debug=true' but just wondered if there was an ifdef equiv in B3D for the build type. Cheers, LW. |
| ||
Nope. |
| ||
As Beaker said, there's no way of detecting this, as far as I'm aware. It would be useful if this feature existed, as there are often times when I want to handle things differently for a debug or release compile. Some of the file handling stuff behaves differently between debug and release modes, also, so it would be useful to be able to select alternate code to compile in each case. All that would be required is an automatically generated constant that holds a value indicating the compile type. You can obvoiusly create a constant and set its value manually, but that sort of micro-management is undesirable, and generally leads to tears before bedtime. |
| ||
You could use an external preprocessor. There are generic preprocessors available that you can use to preprocess just about anything. It just might be a bit complicated to implement it in your IDE. |
| ||
You could use Michael Reitzenstein's Unofficial BlitzBasic Preprocessor which was released in 2003 under the GPL. HERE's the BB.com thread where he announced it, and explained the sort of things it could do (including an IFDEF for DEBUG). And HERE is an archived version of the "feature list" that serves somewhat as a manual, of sorts. Between the examples in the thread above and this, you should be good to go. Hopefully this'll do what you want to do, and (since he doesn't seem to have devoted webspace to this anytime recently) hopefully Michael doesn't mind me sharing this around (GPL and all). |
| ||
See here for the latest version of BlitzBasic Preprocessor, now released under the MIT license. http://www.blitzbasic.com/Community/posts.php?topic=77253 |
| ||
If you use Blide you can detect this. |
| ||
Yes, the built-in My object of blide solutions has a member that has all assembly available information. on a BLIde solution, just use: My.Application.DebugOn This will return TRUE or FALSE depending if the application was a debug build or a release build. Also it has infor such as architecture (it tells it is compiled for x86 or ppc), Platoform (it tells if it is compiled for Linux, MaOs, or windows), Version of the application, etc. EDIT: Remember BLIde is for BlitzMax! not b3d |
| ||
I use IDEal btw, but thanks for the options/ideas. Cheers, LW. |