Page 1 of 1
It is possible to turn of Windows API constants?
Posted: Mon Dec 16, 2013 8:34 am
by Lebostein
I am using Mac OS to write my code. And now I am trying to compile it with Windows. The problem is: I use some names that are reserved for Windows constants and structures. Can I turn of including windows API and constants?
Re: It is possible to turn of Windows API constants?
Posted: Mon Dec 16, 2013 10:18 am
by Fred
you can move the windows.res out of the resident folder and it should do the trick
Re: It is possible to turn of Windows API constants?
Posted: Mon Dec 16, 2013 10:52 am
by PB
It's better in the long run just to rename your constants,
instead of messing around with the PureBasic installation.
Re: It is possible to turn of Windows API constants?
Posted: Mon Dec 16, 2013 12:52 pm
by ts-soft
Code: Select all
CompilerIf Not Defined(WM_CLOSE, #PB_Constant)
#WM_CLOSE = 16
CompilerEndIf
...
Re: It is possible to turn of Windows API constants?
Posted: Mon Dec 16, 2013 2:10 pm
by Shield
That won't fix his problem...
He's talking about that he defined his own constants and structures that conflict with WinAPI names.
------
Maybe you can just prefix your identifiers? I agree with PB, messing with plain
PB installations is not a good solution and it makes the code much less portable.
Re: It is possible to turn of Windows API constants?
Posted: Mon Dec 16, 2013 8:18 pm
by luis
Lebostein wrote:I am using Mac OS to write my code. And now I am trying to compile it with Windows.
So your target is now Windows and not OSX. Change your code accordingly to the new platform or better yet to both, and/or use conditional compilation if required.
Trying to force your way in eradicating what's already natively defined in PB for a specific platform does look a very bad idea to me and it will come back to bite you sooner or later. This if you plan to reuse the code, to share it with someone else, etc.
If you just want to get an EXE right now I suppose Fred 's solution is just what you want.
Re: It is possible to turn of Windows API constants?
Posted: Mon Dec 16, 2013 8:24 pm
by IdeasVacuum
It would be easier to re-name your constants etc. uniquely ~ #Lebostein_WM_CLOSE will not be found on any OS.
Re: It is possible to turn of Windows API constants?
Posted: Tue Dec 31, 2013 5:17 am
by Mistrel
You should probably try to adapt your code around it. You may find the need to use some Win32 voodoo to get everything to run smoothly and then you'll be in trouble!
Re: It is possible to turn of Windows API constants?
Posted: Sat Feb 08, 2014 8:00 am
by Lebostein
Can I add all win constants and structs to the mac version? With this way the mac compiler should warn me if I use reserved things.