Monolithic libraries

Stainless 151 Dec 09, 2012 at 11:01

I am doing a lot of games porting at the moment,

Every company I am working with has their own core library, usually with a wierd name (SexyAppFramework, GFCone…)

This contains all the base engine code with a platform specific layer at the bottom.

What’s concerning me is that this huge block of code has obviously been developed over a period of years and contains stuff that was used in some past game, but isn’t used in other games.

This can be huge chunks of code that I end up porting, but is never used.

Things like zlib, tinyzip, tinyxml, etc. are not too bad , but when I hit things like libcurl it becomes a massive issue.

I am worried about the amount of redundant code I am adding to my games.

On some platforms I am hitting memory problems, of course this is more to do with graphics than code, but it’s still a worry.

Anybody else coming across this?

Any tricks you have come across?

2 Replies

Please log in or register to post a reply.

TheNut 179 Dec 09, 2012 at 13:10

The effort in configuring and building these libraries is one thing and cannot be avoided unless you are given enough information to know that in advance. After the fact however, if you statically build and link against all these libraries, then Visual Studio’s remove unused references (linker option enabled by default on release builds) should give you a compact executable with all dead code removed. Enable whole program optimization for additional benefits. GCC can also do this, but it’s a bit more involved. Use the compiler flags -ffunction-sections and -fdata-sections with the linker flag -Wl,–gc-sections and that will strip out dead code. If however you’re dynamically linking all this stuff, then I don’t know. I’m not sure you have much choice.

Stainless 151 Dec 09, 2012 at 14:53

Our compiler is a LLVM compiler designed on top of gcc, so maybe the gcc options exist.

Certainly worth looking at.