Hey all
I want to combine the Irrlicht lib file into another dll, so that rather than having multiple DLL files I can combine into the one. Do I do this by recompiling Irrlicht as a static lib? It is a bit of a newbish question but I've never known how to do it and can't find anything over the net about it.
Compiling Irrlicht within another library
-
- Posts: 41
- Joined: Sun Nov 09, 2003 10:12 am
- Location: UK
- Contact:
I'm pretty sure there are a fw ways to do it.
I think = that you could compile it as a static lib and include it into another. I don't think you'd have to worry about symbol clashes because of the namespace protection.
Another way is to compile all the object files of Irrlicht along with all the other objects fils of your other libraries into one big library. I'm pretty sure that would give the same kind of result, plus that way you wouldn't neccessarily need to make your giant amalgamted library static, or parially static, the whole thing should be ale to remain dynamic.
Quite how you'd do that though is another matter, I'd supsect that for the second example is would be a matter of compiling all the files into object files as normal for both Irrlicht and the other libs and when it came to the object fils linking stage, you link every object file into a single library.
I'm not sure how you'd set this up in an IDE, but it should be releatively simple to do when compiling by hand.
I think = that you could compile it as a static lib and include it into another. I don't think you'd have to worry about symbol clashes because of the namespace protection.
Another way is to compile all the object files of Irrlicht along with all the other objects fils of your other libraries into one big library. I'm pretty sure that would give the same kind of result, plus that way you wouldn't neccessarily need to make your giant amalgamted library static, or parially static, the whole thing should be ale to remain dynamic.
Quite how you'd do that though is another matter, I'd supsect that for the second example is would be a matter of compiling all the files into object files as normal for both Irrlicht and the other libs and when it came to the object fils linking stage, you link every object file into a single library.
I'm not sure how you'd set this up in an IDE, but it should be releatively simple to do when compiling by hand.
http://www.darkliquid.net - Blog, art, poetry
Yeah, I know I could do it by combining all the library source files into the same project and compiling, however the idea of me moving some of the framework I have built out of my normal compilation and into a dll file is to save on compiling time, I've only scratched the surface of the code I need to write and it already takes a good 10 seconds to compile and this is only likely to go up.
I'll try compiling Irrlicht as a static lib and see if it doesn't compile a dll file. The Freetype library does what I am after, doesn't need a dll to run as it integrates itself in the program when you include the lib file. I may look to see how they did it.
I'll try compiling Irrlicht as a static lib and see if it doesn't compile a dll file. The Freetype library does what I am after, doesn't need a dll to run as it integrates itself in the program when you include the lib file. I may look to see how they did it.
-
- Posts: 41
- Joined: Sun Nov 09, 2003 10:12 am
- Location: UK
- Contact:
So you want a kind of:
project root +
|
+- lib1
+- lib2
+- lib3
+- actively developed code
+- irrlicht
+- freetype
+- etc...
where li1,lib2,lib3 are directories of your own code that is not subject to much change and gets compiled into libs?
In this case, can't you use make targets or something along these lines:
** pseudocode **
target lib1.a:
compile 1.cpp 2.cpp 3.cpp
output lib1.a
target lib2.a:
compile 1.cpp 2.cpp 3.cpp
output lib2.a
target lib3.a:
compile 1.cpp 2.cpp 3.cpp
output lib3.a
target irrlicht.a:
compile 1.cpp 2.cpp 3.cpp
output irrlicht.a
target freetype.a:
compile 1.cpp 2.cpp 3.cpp
output freetype.a
default target mainapp:
require lib1.a lib2.a lib3.a irrlicht.a freetype.a
compile mainapp.cpp
link lib1.a lib2.a lib3.a irrlicht.a freetype.a mainapp.o
output mainapp
** end pseudocode **
This 'makefile' builds mainapp by default, if lib1.a lib2.a lib3.a irrlicht.a or freetype.a aren't already built, or their files have changed, it rebuilds them respectively, otherwise it just builds the mainapp and links in the precompiled libs, skipping the time needed to recompile those libs everytime.
Is that what you want or am I completely missing the point here?
project root +
|
+- lib1
+- lib2
+- lib3
+- actively developed code
+- irrlicht
+- freetype
+- etc...
where li1,lib2,lib3 are directories of your own code that is not subject to much change and gets compiled into libs?
In this case, can't you use make targets or something along these lines:
** pseudocode **
target lib1.a:
compile 1.cpp 2.cpp 3.cpp
output lib1.a
target lib2.a:
compile 1.cpp 2.cpp 3.cpp
output lib2.a
target lib3.a:
compile 1.cpp 2.cpp 3.cpp
output lib3.a
target irrlicht.a:
compile 1.cpp 2.cpp 3.cpp
output irrlicht.a
target freetype.a:
compile 1.cpp 2.cpp 3.cpp
output freetype.a
default target mainapp:
require lib1.a lib2.a lib3.a irrlicht.a freetype.a
compile mainapp.cpp
link lib1.a lib2.a lib3.a irrlicht.a freetype.a mainapp.o
output mainapp
** end pseudocode **
This 'makefile' builds mainapp by default, if lib1.a lib2.a lib3.a irrlicht.a or freetype.a aren't already built, or their files have changed, it rebuilds them respectively, otherwise it just builds the mainapp and links in the precompiled libs, skipping the time needed to recompile those libs everytime.
Is that what you want or am I completely missing the point here?
http://www.darkliquid.net - Blog, art, poetry
i have tried this....
for my work on fnord, i have tried to build a dll file which calls irrlicht's dll, now i wasnt trying to actually link it in so that i only needed mine, but regardless i got all manner of memory access violations. really it was just a total pain in the ass. rather, i have opted to build my lib as a static lib that links in irrlicht, so theoretically, I should need the irrlicht dll at all once my stuff works, it should all be already linked in....i think anyway...hehe i guess we shall see eh??
My irrlicht-based projects have gone underground for now, but if you want, check out my webcomic instead! http://brokenboomerang.net