[odb-users] Using ODB from DLL on Windows XP

Boris Kolpackov boris at codesynthesis.com
Thu Jun 30 02:48:49 EDT 2016


Hi Leo,

Leo Ashkinaziy <Leo_Ashkinaziy at symantec.com> writes:

> * Change configuration type to static library
> * Change preprocessor defines where appropriate to LIBODB_SQLITE_STATIC_LIB,
>   LIBODB_BOOST_STATIC_LIB, and LIBODB_STATIC_LIB

Ok, now we get the missing piece of the puzzle: you not only disabled the
use of the declspec(thread), but you also made all the ODB libraries
static. This is the lethal combination ;-).

When you disable declspec(thread), ODB has to emulate POSIX-like TLS support
and for that it needs to allocate some data structures at process/thread
startup. When libodb is built as a DLL, it does all this automatically
from DllMain(). For a static library, however, you will need to do this
manually (which is also the reason why we don't provide static build
configurations).

In your case, the easiest will probably be to replicate the calls found
in libodb/odb/details/win32/dll.cxx in your DynLib.dll's DllMain().

Boris



More information about the odb-users mailing list