Boost logo

Threads-Devel :

Subject: [Threads-devel] warning LNK4248: unresolved typeref token (0100001E) for 'boost.detail.win32._SECURITY_ATTRIBUTES'; image may not run
From: Andrei Bica (avbica_at_[hidden])
Date: 2009-10-15 08:02:28


I'm using boost in a .NET dll which mixes managed and unmanaged code
(this warnings appears only in this type of dll). When compiling in
release using VS2008 I receive the following warning:

LNK4248: unresolved typeref token (0100001E) for
'boost.detail.win32._SECURITY_ATTRIBUTES'; image may not run

Its look like the _SECURITY_ATTRIBUTES which is defined by windows
headers is forward declared in thread\win32\thread_primitives.hpp but
included in the boost.detail.win32 namespace instead of global namespace.

I've found 2 solutions:

1. a workaround in my code by declaring the
boost.detail.win32._SECURITY_ATTRIBUTES after including the boost headers:
namespace boost { namespace detail { namespace win32 {
        struct _SECURITY_ATTRIBUTES: public ::_SECURITY_ATTRIBUTES {};
};};};
but this is not portable and not very nice.

2. move the forward declaration of _SECURITY_ATTRIBUTES in global namespace

Solution 2 looks much cleaner. Is it possible to change the
thread_primitives.hpp so the _SECURITY_ATTRIBUTES structure is forward
declared in the global namespace? In a way it doesn't make sense to have
extern "C" section in a namespace block since C doesn't have namespaces.

Andrei Bica


Threads-Devel list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk