Advertisement

Size of Static Link Libraries

Started by February 20, 2014 03:37 PM
2 comments, last by arpeggiodragon 10 years, 9 months ago

I compiled the latest version of the AngelScript Library with MSVC 2012 and succeeded in building static link libraries of debug and release version.
Although I didn't change any compiler and linker options of the MSVC project file, the release version's file size was larger than the debug version.

I think the library for debugging has some information in order to find out bugs more easier, so it is larger than the library for release.
Is this my misunderstanding for the library or do I miss an article about its size?

You shouldn't worry too much about the size of the static libraries. It's the size of the final application that matters. :)

The compilers usually include lots of extra information in the static libraries that will allow better optimizations when the final application links with it. Also, many optimizations done by the compiler to improve performance increases the size of the code due to inlining functions, rolling out loops, etc.

The debug information you mention, is actually present in both the debug version and the release version. As you can debug release code too. This information will only be stripped when linking the final application (if the application project tells the linker to strip it).

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Advertisement

I see. I didn't know the static library usually has extra information both debug and release version.

Thank you. smile.png

I actually got a little curious about this so I generated a 'as_unity_build' module to see how much code there would be without duplicate symbols. Must be a case of a bored late-night Monday I guess. :P

Compiling an "in house" release build on Visual Studio with '/MD' and removing the whole program optimization option ('/GL') results in a final object library size of 1.3 MB. (I should note that for full public release builds you generally want link-time code generation, as this allows the linker to do many extra optimizations at the cost of longer link times.)

If anyone is interested here is the cpp file:

// as_unity_build.cpp
// Builds the entire angelscript library simply by compiling this single file.
// *note* This should be the only .cpp file that is compiled; do not include any others.

#include "as_atomic.cpp"
#include "as_builder.cpp"
#include "as_bytecode.cpp"
#include "as_callfunc.cpp"
#include "as_callfunc_arm.cpp"
#include "as_callfunc_mips.cpp"
#include "as_callfunc_ppc.cpp"
#include "as_callfunc_ppc_64.cpp"
#include "as_callfunc_sh4.cpp"
#include "as_callfunc_x64_gcc.cpp"
#include "as_callfunc_x64_mingw.cpp"
#include "as_callfunc_x64_msvc.cpp"
#include "as_callfunc_x86.cpp"
#include "as_callfunc_xenon.cpp"
#include "as_compiler.cpp"
#include "as_configgroup.cpp"
#include "as_context.cpp"
#include "as_datatype.cpp"
#include "as_gc.cpp"
#include "as_generic.cpp"
#include "as_globalproperty.cpp"
#include "as_memory.cpp"
#include "as_module.cpp"
#include "as_objecttype.cpp"
#include "as_outputbuffer.cpp"
#include "as_parser.cpp"
#include "as_restore.cpp"
#include "as_scriptcode.cpp"
#include "as_scriptengine.cpp"
#include "as_scriptfunction.cpp"
#include "as_scriptnode.cpp"
#include "as_scriptobject.cpp"
#include "as_string.cpp"
#include "as_string_util.cpp"
#include "as_thread.cpp"
#include "as_tokenizer.cpp"
#include "as_typeinfo.cpp"
#include "as_variablescope.cpp"

This topic is closed to new replies.

Advertisement