Calling FROM a dll [solved]

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
zotlerg
Posts: 7
Joined: Wed Feb 11, 2009 5:28 pm

Calling FROM a dll [solved]

Post by zotlerg »

Newbie question! :)

Hello, I'm using irrlicht from within a dll, but it complains about not finding the dll unless it's in the Windows System directory.

Is there any way of being able to put the two dll's together, as I just don't want to install stuff into people's Windows folder?

Or failing that, can I just compile Irrlicht straight into my dll without having two files?

Thanks,
Dave
Last edited by zotlerg on Thu Feb 12, 2009 7:10 pm, edited 1 time in total.
FuzzYspo0N
Posts: 914
Joined: Fri Aug 03, 2007 12:43 pm
Location: South Africa
Contact:

Post by FuzzYspo0N »

i guess you mean static linking, but that should be fine.

The other thing is apps look for required dll's in 2 places :

The calling directory
The path , this includes windows directorys

I dont know why the same folder wouldnt find it, but you could always try adding your folder to the path if you are desperate
zotlerg
Posts: 7
Joined: Wed Feb 11, 2009 5:28 pm

Post by zotlerg »

Thanks FuzzYspo0N, of course, the windows path. :roll: I got it all working in just a few lines of code - brilliant!
But I want to do a static link anyway, so I've loaded the Irrlicht project file into my VC9 Solution.
I selected the already made "Static lib - Release" - greatfully included with the project, and it compiles fine. And I've set this as a dependancy to my dll in the solution that worked for dynamic library.
But I'm having trouble compiling, with the following link error:-
error LNK2019: unresolved external symbol "__declspec(dllimport) class irr::IrrlichtDevice * __cdecl irr::createDeviceEx(struct irr::SIrrlichtCreationParameters const &)" (__imp_?createDeviceEx@irr@@YAPAVIrrlichtDevice@1@ABUSIrrlichtCreationParameters@1@@Z) referenced in function "public: virtual bool __thiscall EffectEditor::open(void *)" (?open@EffectEditor@@UAE_NPAX@Z)
The EffectEditor function is my code, and the first reference to Irrlicht. I'm sure that both are using "__cdecl (/Gd)" as the calling convention.
I have to admit I hate these kinds of errors as they just don't seem to tell me anything!
I'm using irrlivth 1.5 and the library builds OK and starts with:-
>------ Build started: Project: Irrlicht, Configuration: Static lib - Release Win32 ------
Can anyone help?
Thanks,
Dave H
zotlerg
Posts: 7
Joined: Wed Feb 11, 2009 5:28 pm

Post by zotlerg »

O.K. I found in IrrCompileConfig.h this:-

// To build Irrlicht as a static library, you must define _IRR_STATIC_LIB_ in both the
// Irrlicht build, *and* in the user application, before #including

And that worked, although I had to rename Irrlicht's DllMain to something else as it conflicted with my own dll which can't be renamed for compatibility down the line.
Please give it a more specific name like "DllMainIrrlicht" or something!

Thanks!
FuzzYspo0N
Posts: 914
Joined: Fri Aug 03, 2007 12:43 pm
Location: South Africa
Contact:

Post by FuzzYspo0N »

i think its the first time someone is static linking inside ANOTHER DLL, and i wouldnt suggest renaming the irrlicht DLLMain, but cool. glad you got it working.

ps, renmaing your thread to say [solved] will help readers down the line.
Post Reply