Alternately, you can follow the advice here. In short, #define BOOST_USE_WINDOWS_H.

M

On Thu, Oct 15, 2009 at 8:02 AM, Andrei Bica <avbica@gmail.com> wrote:
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 mailing list
threads-devel@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/threads-devel