Re: Ver 4.0 ifdef question
- Posted by bernie Sep 03, 2008
- 833 views
I understand that ifdef is a great feature for writing the interpreter because you will always know what operating system it will run on and can set define for that operating system. But if ifdef does not operate at run-time and there is no longer a platform() then how does a cross platform library no what operating system it's running on ???????
It usually does.
ifdef in a library is processed when the library code is being parsed.
If the library is parsed on the machine that will execute its code, then it knows on which OS it is running.
If you translate the library, then you'll need to cross-compile for each target platform, and the translator takes care of the platform dependent ifdefs. Obviously, it doesn't know about ifdef tags that are not platform related, like SAFE, assuming their current status. You need to add command line -D switches for that.
If you bind your library, then something may go wrong. But, with the translator being free, why bind at all? You need a C compiler to translate, but you require your users to have the interpreter if you bind. bind? -shroud_only is still useful for debugging or performance fine tuning.
CChris
I don't think you understand my question. I write a cross platform library that can be used on the following platforms. DOS WINDOWS LINUX A user can include it on any platform. How does the library know what platform it is running on without the platform() ??? What big advantage does removing platform() from the interpeter have ???