Boost logo

Threads-Devel :

Subject: Re: [Threads-devel] boost::this_thread::at_thread_exit - linker issue
From: Peter Thiess (pthiess_at_[hidden])
Date: 2009-04-29 07:54:00

Hi Anthony,

Excellent - your assumption as well as your proposed patch are 100% correct. What a great first time experience at this list! Thanks a lot and have a great day :)


Peter :)

-----Original Message-----
From: threads-devel-bounces_at_[hidden] [mailto:threads-devel-bounces_at_[hidden]] On Behalf Of Anthony Williams
Sent: Mittwoch, 29. April 2009 12:28
To: threads-devel_at_[hidden]
Subject: Re: [Threads-devel] boost::this_thread::at_thread_exit - linker issue

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 mailing list

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