Hi!
I'm interested in crossplattform programming and I looked at Irrlicht source to see how it's done. Now I know how to create shared libs for linux. But I don't know how it works that Irrlicht compiles for Win without havin the keyword '__declspec(dllexport)' inside the code. Every tutorial i've readen about DLL creating uses it, but irrlicht dosn't. So how to do without?
mfg, jeb
Crossplattfrom development
Re: Crossplattfrom development
Incidentally, there are often other ways to export a symbol than that. With the Microsoft tools, for example, you can do it with a ".DEF" file containing an EXPORTS section, or you can do it with a linker commandline switch.JEB wrote:But I don't know how it works that Irrlicht compiles for Win without havin the keyword '__declspec(dllexport)' inside the code. Every tutorial i've readen about DLL creating uses it, but irrlicht dosn't. So how to do without?
Jeb:
There is only one __declspec(dllexport) because Irrlicht.dll only exports one symbol: createDevice(). (Actually it exports two, createDeviceEx() is also exported).
Everything else is a returned pointer.
A common practice when creating shared libraries is to do:
Then, when building the library, you #define EXPORTS. When using the library, you don't #define anything, so it automagically declares the functions as dll imports.
There is only one __declspec(dllexport) because Irrlicht.dll only exports one symbol: createDevice(). (Actually it exports two, createDeviceEx() is also exported).
Everything else is a returned pointer.
A common practice when creating shared libraries is to do:
Code: Select all
#ifdef EXPORTS
#define IRRLICHT_API __declspec(dllexport)
#else
#define IRRLICHT_API __declspec(dllimport)
#endif