|
Boost : |
From: Martin Schuerch (mschuerch_at_[hidden])
Date: 2002-10-13 06:06:08
Peter,
you asked around the 20. august to build a minimal testapplication which
reproduce the following link error (under VC7 where some files in /CLR mode
are involved).
> > Custom attributes are not consistent: (0x0c0006cd).
> > LINK : fatal error LNK1254: metadata for symbol
> > '?InterlockedExchange_at_winapi@detail_at_boost@@$$J18YGJPCJJ_at_Z' inconsistent
In small applications the error didn't show up, so I had to use shared_ptr
without threading support.
The error is still there in boost 1.2.9.
I finally got the reason. It's the function delarations which are inside the
namespace boost::detail::winapi (winapi.hpp). They have to be global.
A file which works for me (you have to modify it for the 64 bit version) is
appended.
Martin
#ifndef BOOST_DETAIL_WINAPI_HPP_INCLUDED
#define BOOST_DETAIL_WINAPI_HPP_INCLUDED
#if _MSC_VER >= 1020
#pragma once
#endif
#pragma pack(push,8)
//
// 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
}
}
}
extern "C" __declspec(dllimport) boost::detail::winapi::long_type __stdcall
InterlockedIncrement(long volatile *);
extern "C" __declspec(dllimport) boost::detail::winapi::long_type __stdcall
InterlockedDecrement(long volatile *);
extern "C" __declspec(dllimport) boost::detail::winapi::long_type __stdcall
InterlockedExchange(long volatile *, boost::detail::winapi::long_type);
namespace boost
{
namespace detail
{
namespace winapi
{
struct critical_section
{
struct critical_section_debug * DebugInfo;
long_type LockCount;
long_type RecursionCount;
handle_type OwningThread;
handle_type LockSemaphore;
ulong_ptr_type SpinCount;
};
#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);
}
#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
#pragma pack(pop)
#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