static link lib

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
ferdi

static link lib

Post by ferdi »

hi everyone
is it possible to build a static link library (no dll) to link directly with my app so i don't have to add the dll to the package?

thank you
ferdi
MattyBoy
Posts: 19
Joined: Fri Oct 24, 2003 3:07 pm

How To

Post by MattyBoy »

1.) Add the following to irrlicht.h

#define IRRLICHT_EXPORTS

2.) Change the project to a static library

3.) Added the appropriate path to "Additional Libraries Directories" in the linker properties of you application and include "irrlicht.h"


That should do it.
MattyBoy
Posts: 19
Joined: Fri Oct 24, 2003 3:07 pm

Lets try this again

Post by MattyBoy »

OK, Lets try this again.

In the Irrlicht.h (DON'T FORGET their are TWO Irrlich.h file) Replace the similar section with

#if defined(WIN32) && !defined(IRRLICHT_STATIC)
#ifdef IRRLICHT_EXPORTS
#define IRRLICHT_API __declspec(dllexport)
#else
#define IRRLICHT_API __declspec(dllimport)
#endif // IRRLICHT_EXPORT
#else
#define IRRLICHT_API
#endif // WIN32

In the CIrrDeviceWin32.cpp replace the similar section with

#if !defined(IRRLICHT_STATIC)
#ifdef IRRLICHT_EXPORTS
#define IRRLICHT_API __declspec(dllexport)
#else
#define IRRLICHT_API __declspec(dllimport)
#endif
#else
#define IRRLICHT_API
#endif

Then in your project properties->C/C++->PreProcessor definitions put in
IRRLICHT_STATIC

Then do a clean and recompile everything.
Post Reply