[fixed]DllMain in Irrlicht.cpp

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
AReichl
Posts: 269
Joined: Wed Jul 13, 2011 2:34 pm

[fixed]DllMain in Irrlicht.cpp

Post by AReichl »

Hello,
i found, that if i link Irrlicht statically, it can happen that i get "multiple DllMain" errors (depending on other libraries, that probably also have a DllMain).
It happens for example with Curl, if you also link Curl statically.

What about changing in Irrlicht.cpp

#if defined( _IRR_WINDOWS_API_ )

to

#if defined( _IRR_WINDOWS_API_ ) && ! defined( _IRR_STATIC_LIB_ )

?
CuteAlien
Admin
Posts: 9651
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: DllMain in Irrlicht.cpp

Post by CuteAlien »

Yeah, that looks also more correct to me. Changed in r4904 in trunk. I'm not on Windows right now, so I hope I don't mess up, but looks rather risk-free to me. Feedback if it works is welcome.

Thanks for reporting.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
AReichl
Posts: 269
Joined: Wed Jul 13, 2011 2:34 pm

Re: [fixed]DllMain in Irrlicht.cpp

Post by AReichl »

It works.

I discovered this problem when compiling SpaceCombat. SpaceCombat NEEDS a static Irrlicht lib, because it inherits Classes directly from Irrlicht classes, and that only works if linked statically. So far so good. BUT SpaceCombat also uses Curl ( also as a static lib ), and Curls seems ALSO to have a DllMain in the static build - and bang! Now of course i could link Curl as a dynamic lib, but i don't want to mess around with the settings. Anyway - having DllMain out of the static Irrlicht lib is the right thing to do; maybe someone else has problems with this together with other static libs.

Because we are talking about libs here - i have another "proposal":
- the dynamic Irrlicht lib should be named "libIrrlicht.dll.a" with the dll itself having the name "Irrlicht.dll" ( on Windows - i am not sure about naming conventions on Linux ).
- the static lib stays with it's present name "libIrrlicht.a".
This way we can build both without name clashes.
But this is not important right now - maybe something for Irrlicht 2.0.
Post Reply