Boost logo

Boost :

From: Alkis Evlogimenos (alkis_at_[hidden])
Date: 2002-10-15 16:54:18


On Tuesday 15 October 2002 02:17 pm, Rene Rivera wrote:
> [2002-10-15] Alkis Evlogimenos wrote:
> >Hi,
> >
> >>From a previous post (library build confusion) there was a brief mention
>
> of
>
> >what a runtime-link-dynamic library is:
> >
> >This static library is built for linking to a dynamic runtime library.
> >
> >Can someone elaborate on the uses of the 2 different static library types?
> >More specifically which of the 2 static ones should I use to create
> >executables? runtime-link-dynamic or runtime-link-static, or it doesn't
> >matter? Why does a static library need to be different if is build for
> >linking to a dynamic library?
>
> <runtime-link> refers to the type of Standard C++ Runtime library to use.
> Most platforms support using both a library that is statically linked, all
> the code is bundled with your application/dll/so. And using a library that
> is dynamically linked, i.e. it's a shared object (DLL, or SO, etc).

So if I get it correctly:
runtime-link-static: creates a static library that is statically linked to the
C++ runtime
runtime-link-dynamic: creates a static library that is dynamically linked to
the C++ runtime (is this possible?)
shared-linkable-true: creates a shared library that is dynamically linked to
the C++ library

I am using linux and both runtime-link-dynamic and runtime-link-static are
static libraries. They also have the same size but the binaries differ (at
least this is what diff says).

As an example I dumped the symbols for
./libs/thread/build/bin/libboost_thread.a/rs/debug/runtime-link-{static,dynamic}/threading-multi/libboost_thread.a
and I get the following diff:

11,15c11,15
< 0000048c r
_55_GLOBAL_.N.libs_thread_build_.._src_condition.cpphFMCVc.MICROSECONDS_PER_SECOND
< 00000480 r
_55_GLOBAL_.N.libs_thread_build_.._src_condition.cpphFMCVc.MILLISECONDS_PER_SECOND
< 00000490 r
_55_GLOBAL_.N.libs_thread_build_.._src_condition.cpphFMCVc.NANOSECONDS_PER_MICROSECOND
< 00000488 r
_55_GLOBAL_.N.libs_thread_build_.._src_condition.cpphFMCVc.NANOSECONDS_PER_MILLISECOND
< 00000484 r
_55_GLOBAL_.N.libs_thread_build_.._src_condition.cpphFMCVc.NANOSECONDS_PER_SECOND

---
> 0000048c r 
_55_GLOBAL_.N.libs_thread_build_.._src_condition.cppbBULtb.MICROSECONDS_PER_SECOND
> 00000480 r 
_55_GLOBAL_.N.libs_thread_build_.._src_condition.cppbBULtb.MILLISECONDS_PER_SECOND
> 00000490 r 
_55_GLOBAL_.N.libs_thread_build_.._src_condition.cppbBULtb.NANOSECONDS_PER_MICROSECOND
> 00000488 r 
_55_GLOBAL_.N.libs_thread_build_.._src_condition.cppbBULtb.NANOSECONDS_PER_MILLISECOND
> 00000484 r 
_55_GLOBAL_.N.libs_thread_build_.._src_condition.cppbBULtb.NANOSECONDS_PER_SECOND
71c71
< 00000000 W 
to_timespec__55_GLOBAL_.N.libs_thread_build_.._src_condition.cpphFMCVcRCQ25boost5xtimeR8timespec
---
> 00000000 W 
to_timespec__55_GLOBAL_.N.libs_thread_build_.._src_condition.cppbBULtbRCQ25boost5xtimeR8timespec
87,91c87,91
< 0000068c r 
_51_GLOBAL_.N.libs_thread_build_.._src_mutex.cppkb3Peb.MICROSECONDS_PER_SECOND
< 00000680 r 
_51_GLOBAL_.N.libs_thread_build_.._src_mutex.cppkb3Peb.MILLISECONDS_PER_SECOND
< 00000690 r 
_51_GLOBAL_.N.libs_thread_build_.._src_mutex.cppkb3Peb.NANOSECONDS_PER_MICROSECOND
< 00000688 r 
_51_GLOBAL_.N.libs_thread_build_.._src_mutex.cppkb3Peb.NANOSECONDS_PER_MILLISECOND
< 00000684 r 
_51_GLOBAL_.N.libs_thread_build_.._src_mutex.cppkb3Peb.NANOSECONDS_PER_SECOND
---
> 0000068c r 
_51_GLOBAL_.N.libs_thread_build_.._src_mutex.cppUeXi8c.MICROSECONDS_PER_SECOND
> 00000680 r 
_51_GLOBAL_.N.libs_thread_build_.._src_mutex.cppUeXi8c.MILLISECONDS_PER_SECOND
> 00000690 r 
_51_GLOBAL_.N.libs_thread_build_.._src_mutex.cppUeXi8c.NANOSECONDS_PER_MICROSECOND
> 00000688 r 
_51_GLOBAL_.N.libs_thread_build_.._src_mutex.cppUeXi8c.NANOSECONDS_PER_MILLISECOND
> 00000684 r 
_51_GLOBAL_.N.libs_thread_build_.._src_mutex.cppUeXi8c.NANOSECONDS_PER_SECOND
169c169
< 00000000 W 
to_timespec__51_GLOBAL_.N.libs_thread_build_.._src_mutex.cppkb3PebRCQ25boost5xtimeR8timespec
---
> 00000000 W 
to_timespec__51_GLOBAL_.N.libs_thread_build_.._src_mutex.cppUeXi8cRCQ25boost5xtimeR8timespec
185,189c185,189
< 0000090c r 
_61_GLOBAL_.N.libs_thread_build_.._src_recursive_mutex.cpp8pYmFc.MICROSECONDS_PER_SECOND
< 00000900 r 
_61_GLOBAL_.N.libs_thread_build_.._src_recursive_mutex.cpp8pYmFc.MILLISECONDS_PER_SECOND
< 00000910 r 
_61_GLOBAL_.N.libs_thread_build_.._src_recursive_mutex.cpp8pYmFc.NANOSECONDS_PER_MICROSECOND
< 00000908 r 
_61_GLOBAL_.N.libs_thread_build_.._src_recursive_mutex.cpp8pYmFc.NANOSECONDS_PER_MILLISECOND
< 00000904 r 
_61_GLOBAL_.N.libs_thread_build_.._src_recursive_mutex.cpp8pYmFc.NANOSECONDS_PER_SECOND
---
> 0000090c r 
_61_GLOBAL_.N.libs_thread_build_.._src_recursive_mutex.cppW8hmla.MICROSECONDS_PER_SECOND
> 00000900 r 
_61_GLOBAL_.N.libs_thread_build_.._src_recursive_mutex.cppW8hmla.MILLISECONDS_PER_SECOND
> 00000910 r 
_61_GLOBAL_.N.libs_thread_build_.._src_recursive_mutex.cppW8hmla.NANOSECONDS_PER_MICROSECOND
> 00000908 r 
_61_GLOBAL_.N.libs_thread_build_.._src_recursive_mutex.cppW8hmla.NANOSECONDS_PER_MILLISECOND
> 00000904 r 
_61_GLOBAL_.N.libs_thread_build_.._src_recursive_mutex.cppW8hmla.NANOSECONDS_PER_SECOND
269c269
< 00000000 W 
to_timespec__61_GLOBAL_.N.libs_thread_build_.._src_recursive_mutex.cpp8pYmFcRCQ25boost5xtimeR8timespec
---
> 00000000 W 
to_timespec__61_GLOBAL_.N.libs_thread_build_.._src_recursive_mutex.cppW8hmlaRCQ25boost5xtimeR8timespec
291c291
< 00000000 W 
_._Q252_GLOBAL_.N.libs_thread_build_.._src_thread.cppAjCIid12thread_param
---
> 00000000 W 
_._Q252_GLOBAL_.N.libs_thread_build_.._src_thread.cpprbcD9b12thread_param
302,306c302,306
< 0000078c r 
_52_GLOBAL_.N.libs_thread_build_.._src_thread.cppAjCIid.MICROSECONDS_PER_SECOND
< 00000780 r 
_52_GLOBAL_.N.libs_thread_build_.._src_thread.cppAjCIid.MILLISECONDS_PER_SECOND
< 00000790 r 
_52_GLOBAL_.N.libs_thread_build_.._src_thread.cppAjCIid.NANOSECONDS_PER_MICROSECOND
< 00000788 r 
_52_GLOBAL_.N.libs_thread_build_.._src_thread.cppAjCIid.NANOSECONDS_PER_MILLISECOND
< 00000784 r 
_52_GLOBAL_.N.libs_thread_build_.._src_thread.cppAjCIid.NANOSECONDS_PER_SECOND
---
> 0000078c r 
_52_GLOBAL_.N.libs_thread_build_.._src_thread.cpprbcD9b.MICROSECONDS_PER_SECOND
> 00000780 r 
_52_GLOBAL_.N.libs_thread_build_.._src_thread.cpprbcD9b.MILLISECONDS_PER_SECOND
> 00000790 r 
_52_GLOBAL_.N.libs_thread_build_.._src_thread.cpprbcD9b.NANOSECONDS_PER_MICROSECOND
> 00000788 r 
_52_GLOBAL_.N.libs_thread_build_.._src_thread.cpprbcD9b.NANOSECONDS_PER_MILLISECOND
> 00000784 r 
_52_GLOBAL_.N.libs_thread_build_.._src_thread.cpprbcD9b.NANOSECONDS_PER_SECOND
361c361
< 00000000 W 
__Q252_GLOBAL_.N.libs_thread_build_.._src_thread.cppAjCIid12thread_paramRCQ25boostt9function04ZvZQ25boost21empty_function_policyZQ25boost20empty_function_mixinZQ24_STLt9allocator1ZQ25boost13function_base
---
> 00000000 W 
__Q252_GLOBAL_.N.libs_thread_build_.._src_thread.cpprbcD9b12thread_paramRCQ25boostt9function04ZvZQ25boost21empty_function_policyZQ25boost20empty_function_mixinZQ24_STLt9allocator1ZQ25boost13function_base
478c478
< 00000000 W 
started__Q252_GLOBAL_.N.libs_thread_build_.._src_thread.cppAjCIid12thread_param
---
> 00000000 W 
started__Q252_GLOBAL_.N.libs_thread_build_.._src_thread.cpprbcD9b12thread_param
481c481
< 00000000 W 
to_timespec_duration__52_GLOBAL_.N.libs_thread_build_.._src_thread.cppAjCIidRCQ25boost5xtimeR8timespec
---
> 00000000 W 
to_timespec_duration__52_GLOBAL_.N.libs_thread_build_.._src_thread.cpprbcD9bRCQ25boost5xtimeR8timespec
486c486
< 00000000 W 
wait__Q252_GLOBAL_.N.libs_thread_build_.._src_thread.cppAjCIid12thread_param
---
> 00000000 W 
wait__Q252_GLOBAL_.N.libs_thread_build_.._src_thread.cpprbcD9b12thread_param
545,546c545,546
< 00000000 B _50_GLOBAL_.N.libs_thread_build_.._src_once.cppzdWaPd.key
< 00000000 D _50_GLOBAL_.N.libs_thread_build_.._src_once.cppzdWaPd.once
---
> 00000000 B _50_GLOBAL_.N.libs_thread_build_.._src_once.cppDGNIGe.key
> 00000000 D _50_GLOBAL_.N.libs_thread_build_.._src_once.cppDGNIGe.once
It looks like only the name mangling differs. So I assume linking to either 
one will result in an executable that will behave the same. Maybe linux 
doesn't do a distinction between linking dynamically to the C++ runtime or 
not?
> Which type depends somewhat on your deployment preference, and more on the
> specific platform you are using and what type of code you are writting.
> Most of the time you want to use the dynamic runtime as it makes C++
> exceptions and memory allocs/deallocs work when using other C++ dynamic
> libraries. But if you have an entirely self contained program you could use
> the static runtime to reduce deployment dependencies.
>
> HTH.
>
>
> -- grafik - Don't Assume Anything
> -- rrivera_at_[hidden] - grafik_at_[hidden]
> -- 102708583_at_icq - Grafik666_at_AIM - Grafik_at_[hidden]
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
-- 
Alkis

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk