Boost logo

Threads-Devel :

Subject: Re: [Threads-devel] boost::this_thread::at_thread_exit - linker issue
From: Anthony Williams (anthony_at_[hidden])
Date: 2009-04-29 06:27:41

At Wed 29 Apr 2009 10:55:25 BST, Peter Thiess <pthiess_at_[hidden]> wrote:

> I just started to play around with boost threads a bit and got stuck
> with the following linker message:
> DQThread.obj : error LNK2001: unresolved external symbol "void
> __cdecl boost::detail::add_thread_exit_function(struct
> boost::detail::thread_exit_function_base *)"
> (?add_thread_exit_function_at_detail@boost@@YAXPAUthread_exit_function_base_at_12@@Z)
> I'm using the following code line:
> boost::this_thread::at_thread_exit(&DQThread::OnErrorExit);
> which compiles fine. Searching the libraries I couldn't find
> 'add_thread_exit_function' either. I wonder if it is exported at
> all? What am I missing? I'd be really greateful for any hints in
> this regard :)

This function is defined in libs/thread/src/win32/thread.cpp or

By your use of the term "exported", I'm guessing that you're using the
DLL version of boost.thread.

Unfortunately, the declaration for add_thread_exit_function is missing
the BOOST_THREAD_DECL part which exports the functions from the DLL.
If you patch the header file and rebuild boost.thread and your app,
this should be fine.

The declaration should be

  void BOOST_THREAD_DECL add_thread_exit_function(thread_exit_function_base*);


Anthony Williams
Author of C++ Concurrency in Action |
just::thread C++0x thread library   |
Custom Software Development         |
Just Software Solutions Ltd, Registered in England, Company Number 5478976.
Registered Office: 15 Carrallack Mews, St Just, Cornwall, TR19 7UL, UK

Threads-Devel list run by bdawes at, david.abrahams at, gregod at, cpdaniel at, john at