Crossplattfrom development

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki
Post Reply
JEB

Crossplattfrom development

Post 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
Guest

Post by Guest »

irrlicht has the __declspec(dllexport) in it, search through the irrlicht source and you will find several matches.

ps: wrong thread ;)
Guest

Post 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 :?
Guest

Post by Guest »

no, just a few have it. just search for "dllexport" in all files then you should get the results :)
Murphy
Posts: 290
Joined: Mon Dec 13, 2004 12:06 am
Location: United States
Contact:

Re: Crossplattfrom development

Post 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.
jeb
Posts: 3
Joined: Thu Nov 10, 2005 9:48 pm
Location: TG - Switzerland
Contact:

Post 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
zenaku
Posts: 212
Joined: Tue Jun 07, 2005 11:23 pm

Post 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.
Post Reply