Matthias <nospam@digitalraid.com> writes:
I know that ld has a flag called static.
Only *some* ld's understand '-static'. It is not a "universally
understood" flag.
Gcc/g++ always understands '-static' and translates it into the
appropriate linker flags are OS depend.
But what if I don't want ALL
libs to be statically linked, but only some?
It is impossible to answer your question without knowing the OS.
However, taking an educated guess that you are on Linux, the
answer is:
g++ ... main.o ... -Wl,-Bstatic -lboost -Wl,-Bdynamic -lgtkmm ...
Be sure *not* to do this:
g++ ... main.o ... -lgtkmm -Wl,-Bstatic -lboost
The above is wrong because it leaves '-Bstatic' "hanging". It will
cause other libraries (e.g. libc, libstdc++, which are added to
the link line by 'g++') to be linked statically as well, and
will result in much grief later on.
Cheers,