|
Boost : |
From: Martin Schuerch (mschuerch_at_[hidden])
Date: 2002-12-19 11:47:58
Hi
I already posted once the following problem (solution). The problem is still
there in the code of the boost repository. I doesn't know if there are
reasons to not apply the patch, (e.g. global namespace polution) or if the
post was missed.
Problem:
In my project (some files are compiled with the /CLR flag) I get the
following link error under VC7.
pplib.lib(PPFacadeNet.obj) : error LNK2022: metadata operation failed
(80131195) : Custom attributes are not consistent: (0x0c0008f2).
LINK : fatal error LNK1254: metadata for symbol
'?InterlockedExchange_at_winapi@detail_at_boost@@$$J18YGJPCJJ_at_Z' inconsistent with
COFF symbol table
The problem is (after a long search), that the forward declarations of e.g.
InterlockedExchange (win32) are inside a namespace. When they are global it
works.
A working file is appended.
Martin
#ifndef BOOST_DETAIL_WINAPI_HPP_INCLUDED
#define BOOST_DETAIL_WINAPI_HPP_INCLUDED
#if _MSC_VER >= 1020
#pragma once
#endif
//
// boost/detail/winapi.hpp - a lightweight version of <windows.h>
//
// Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
//
// Permission to copy, use, modify, sell and distribute this software
// is granted provided this copyright notice appears in all copies.
// This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
//
namespace boost
{
namespace detail
{
namespace winapi
{
typedef long long_type;
typedef unsigned long dword_type;
typedef void * handle_type;
#if defined(_WIN64)
typedef __int64 int_ptr_type;
typedef unsigned __int64 uint_ptr_type;
typedef __int64 long_ptr_type;
typedef unsigned __int64 ulong_ptr_type;
#else
typedef int int_ptr_type;
typedef unsigned int uint_ptr_type;
typedef long long_ptr_type;
typedef unsigned long ulong_ptr_type;
#endif
struct critical_section
{
struct critical_section_debug * DebugInfo;
long_type LockCount;
long_type RecursionCount;
handle_type OwningThread;
handle_type LockSemaphore;
ulong_ptr_type SpinCount;
};
}}}
// global declarations
#if defined(_WIN64)
extern "C" boost::detail::winapi::long_type __cdecl
_InterlockedIncrement(boost::detail::winapi::long_type volatile *);
extern "C" boost::detail::winapi::long_type __cdecl
_InterlockedDecrement(boost::detail::winapi::long_type volatile *);
extern "C" boost::detail::winapi::long_type __cdecl
_InterlockedExchange(boost::detail::winapi::long_type volatile *,
long_type);
#pragma intrinsic(_InterlockedIncrement)
#pragma intrinsic(_InterlockedDecrement)
#pragma intrinsic(_InterlockedExchange)
#else
extern "C" __declspec(dllimport) boost::detail::winapi::long_type __stdcall
InterlockedIncrement(boost::detail::winapi::long_type volatile *);
extern "C" __declspec(dllimport) boost::detail::winapi::long_type __stdcall
InterlockedDecrement(boost::detail::winapi::long_type volatile *);
extern "C" __declspec(dllimport) boost::detail::winapi::long_type __stdcall
InterlockedExchange(boost::detail::winapi::long_type volatile *,
boost::detail::winapi::long_type);
#endif
namespace boost
{
namespace detail
{
namespace winapi
{
#if defined(_WIN64)
// Intel 6.0 on Win64 version, posted by Tim Fenders to [boost-users]
//extern "C" long_type __cdecl _InterlockedIncrement(long_type volatile *);
//extern "C" long_type __cdecl _InterlockedDecrement(long_type volatile *);
//extern "C" long_type __cdecl _InterlockedExchange(long_type volatile *,
long_type);
//
//#pragma intrinsic(_InterlockedIncrement)
//#pragma intrinsic(_InterlockedDecrement)
//#pragma intrinsic(_InterlockedExchange)
inline long_type InterlockedIncrement(long_type volatile * lp)
{
return _InterlockedIncrement(lp);
}
inline long_type InterlockedDecrement(long_type volatile* lp)
{
return _InterlockedDecrement(lp);
}
inline long_type InterlockedExchange(long_type volatile* lp, long_type l)
{
return _InterlockedExchange(lp, l);
}
#else
inline long_type InterlockedIncrement(long_type volatile * lp)
{
return ::InterlockedIncrement(lp);
}
inline long_type InterlockedDecrement(long_type volatile* lp)
{
return ::InterlockedDecrement(lp);
}
inline long_type InterlockedExchange(long_type volatile* lp, long_type l)
{
return ::InterlockedExchange(lp, l);
}
//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);
#endif
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 *);
} // namespace winapi
} // namespace detail
} // namespace boost
#endif // #ifndef BOOST_DETAIL_WINAPI_HPP_INCLUDED
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk