Boost logo

Boost Users :

Subject: Re: [Boost-users] [thread] C++/CLI C# mixed code: linking to libthread yields runtime exception
From: Markus Werle (numerical.simulation_at_[hidden])
Date: 2009-02-05 10:59:19


Anthony Williams <anthony.ajw <at> gmail.com> writes:

> Link against the Boost.Thread DLL. Build your app with
> BOOST_THREAD_USE_DLL defined to force the auto-link to choose this,
> and ensure that the code is compatible.

Many thanks for taking time to clarify the issue.
Defining BOOST_THREAD_USE_DLL in the mini demo project helps.
(Only ilmerge fails to merge the C++/CLI DLL with the C# executable ...)

Alas, for the RealWorld example containing some more spirit parser
code this does not help either. The linker now correctly chooses
the DLL:

Linking...
Searching libraries
    Searching D:\Programme\Microsoft Visual Studio 9.0\VC\lib\MSVCRT.lib:
    Searching D:\Programme\Microsoft Visual Studio 9.0\VC\lib\OLDNAMES.lib:
    Searching D:\Programme\Microsoft Visual Studio 9.0\VC\lib\MSVCMRT.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\MSCOREE.lib:
    Searching D:\Programme\Microsoft Visual Studio 9.0\VC\lib\msvcprt.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\uuid.lib:
    Searching D:\Programme\Microsoft Visual Studio 9.0\VC\lib\comsupp.lib:
    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\oleaut32.lib:
    Searching D:\FEV-Data\Sourcen\FEV\TOPexpert\3rdParty\BOOST\boost_1_37_0
\stage\lib\boost_thread-vc90-mt-1_37.lib:
    Searching D:\FEV-Data\Sourcen\FEV\TOPexpert\3rdParty\BOOST\boost_1_37_0
\stage\lib\libboost_date_time-vc90-mt-1_37.lib:

but the executable shows the System.BadImageFormatException again.

Any further idea?
Am I not allowed to mix the static inclusion of date_time with the dynamic
version of threads?
I also tried BOOST_DYN_LINK, but even then libboost_date_time-vc90-mt-1_37.lib
ist used by the linker. Then used BOOST_DATE_TIME_DYN_LINK
which should have the same effect, but then linking chooses the correct libs:

Searching libraries
[...]
    Searching D:\FEV-Data\Sourcen\FEV\TOPexpert\3rdParty\BOOST\boost_1_37_0
\stage\lib\boost_thread-vc90-mt-1_37.lib:
    Searching D:\FEV-Data\Sourcen\FEV\TOPexpert\3rdParty\BOOST\boost_1_37_0
\stage\lib\boost_date_time-vc90-mt-1_37.lib:

This looks odd to me. Ain't this a bug for DATE_TIME?

Anyway, even then System.BadImageFormatException is thrown.
I am lost again.

regards,

Markus


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net