Page 1 of 1
Crossplattfrom development
Posted: Thu Nov 10, 2005 9:33 pm
by JEB
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
Posted: Thu Nov 10, 2005 9:35 pm
by Guest
irrlicht has the __declspec(dllexport) in it, search through the irrlicht source and you will find several matches.
ps: wrong thread
Posted: Thu Nov 10, 2005 9:40 pm
by Guest
I looked at a few files, i can't find it. And also i thought every function and class needs the Keyword. So in fact, every header file should include it
Posted: Thu Nov 10, 2005 9:56 pm
by Guest
no, just a few have it. just search for "dllexport" in all files then you should get the results
Re: Crossplattfrom development
Posted: Thu Nov 10, 2005 10:02 pm
by Murphy
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?
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.
Posted: Thu Nov 10, 2005 10:07 pm
by jeb
So I looked at much header files and i've found it once: for the 'IrrlichtDevice* createDevice()'.
Murphy: Can you post a link where your possibility is descriped?
mfg, jeb
Posted: Fri Nov 18, 2005 11:03 am
by zenaku
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:
Code: Select all
#ifdef EXPORTS
#define IRRLICHT_API __declspec(dllexport)
#else
#define IRRLICHT_API __declspec(dllimport)
#endif
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.