Boost logo

Boost :

From: Martin Schuerch (mschuerch_at_[hidden])
Date: 2002-08-19 05:42:43


Hi

In a VC project with boost, ATL and mangaged extensions I get the following
link error:

PPFacadeNet.obj : error LNK2022: metadata operation failed (80131195) :
Custom attributes are not consistent: (0x0c0006cd).
LINK : fatal error LNK1254: metadata for symbol
'?InterlockedExchange_at_winapi@detail_at_boost@@$$J18YGJPCJJ_at_Z' inconsistent with
COFF symbol table

When I include <windows.h> in winapi.hpp and make the hacks:

typedef CRITICAL_SECTION critical_section;

inline long_type InterlockedIncrement(long_type volatile * x){ return
::InterlockedIncrement(x); }
inline long_type __stdcall InterlockedDecrement(long_type volatile *x) {
return ::InterlockedDecrement(x); }
inline long_type __stdcall InterlockedExchange(long_type volatile *x,
long_type d) { return ::InterlockedExchange(x,d); }
//
inline void Sleep(dword_type d) { ::Sleep(d); }
//
inline void InitializeCriticalSection(critical_section * s)
{::InitializeCriticalSection(s); }
inline void EnterCriticalSection(critical_section * s)
{::EnterCriticalSection(s); }
inline void LeaveCriticalSection(critical_section * s)
{::LeaveCriticalSection(s); }
inline void DeleteCriticalSection(critical_section * s)
{::DeleteCriticalSection(s); }

Then it works.

So I assume, the problem have to be related to the forward declarations (in
winapi.hpp):

extern "C" __declspec(dllimport) long_type __stdcall
InterlockedIncrement(long_type volatile *);
extern "C" __declspec(dllimport) long_type __stdcall
InterlockedDecrement(long_type volatile *);
extern "C" __declspec(dllimport) long_type __stdcall
InterlockedExchange(long_type volatile *, long_type);
//
extern "C" __declspec(dllimport) void __stdcall Sleep(dword_type);
//
extern "C" __declspec(dllimport) void __stdcall
InitializeCriticalSection(critical_section *);
extern "C" __declspec(dllimport) void __stdcall
EnterCriticalSection(critical_section *);
extern "C" __declspec(dllimport) void __stdcall
LeaveCriticalSection(critical_section *);
extern "C" __declspec(dllimport) void __stdcall
DeleteCriticalSection(critical_section *);

Any ideas?

Martin


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