[Bf-committers] Plugins in win32 installation of blender
Stephane SOPPERA
stephane.soppera at wanadoo.fr
Sun Jul 16 17:48:21 CEST 2006
Joe Eagar a écrit :
> Stephane SOPPERA wrote:
>>> P.S.: thanks the yafray guys for the LIBEXTERN macro I used btw :) .
>> Joe
>> About it, why is it using WIN32 and not _WIN32? Are mingw or other
>> win32 compiler using WIN32 define and not _WIN32 as MSVC?
>>
> Hopefully WIN32 is defined by the build environment if it's not there.
For a plugin the build environment is usually only the msvc compiler run
on the command line, isn't it? So as far as I known, headers for plugins
should not rely on anything else than what the compiler itself defines.
> Honestly, I've never seen a project that used _WIN32, it's always
> WIN32. So I don't really know what's going on, all these WIN32 _WIN32
> _WINDOWS_ macros are a little confusing :) .
MSVC does not define WIN32 only _WIN32. I was surprised to see WIN32
since I'm used to see _WIN32 in all the code I've ever seen (except
blender of course ;-)
See this page from MSDN :
http://msdn2.microsoft.com/en-us/library/b0084kay.aspx
it shows the default preprocessor macros defined by MSVC. You can see
that only _WIN32 is defined.
Usually preprocessor names starting with an "_" are reserved for
compilers. So that's normal to see _WIN32.
So that's why I'm wondering which windows C compiler defines WIN32
instead of _WIN32.
Is it just blender build environment that defines it or are there some
windows C compilers (gcc, lcc) that defines WIN32 instead of _WIN32?
In case gcc or lcc defines WIN32 instead of _WIN32 the solution might be
to test both macros instead of one.
> But you can use blender functions in your plugins right?
Yes, that's what I said: even if LIBEXTERN is replaced by "extern" and
not "extern __declspec(dllimport)" it works perfectly.
I've looked on MSDN for an explanation but only "dllexport" is correctly
documented; "dllimport" is not really explained.
Stéphane
More information about the Bf-committers
mailing list