Boost logo

Boost :

From: Roland (roland.schwarz_at_[hidden])
Date: 2004-08-05 03:43:05


On Thu, 05 Aug 2004 10:07:47 +0200 Bronek Kozicki <brok_at_[hidden]> wrote:

> Johan Nilsson wrote:
> > If this is the case, could it be that the linker discards the symbols as
> > they are not obviously referenced by the .exe code? Could you try to force
> > the librarian to reference those symbols (under VC7.1 it's the /INCLUDE:
> > option for the lib - don't have access to VC6 at the moment).
>
> Bingo! I've added to test project:
> #pragma comment(linker, "/include:_p_thread_callback")
> and it works now. I'm attaching MSVC6 project for others to try it :)

This can be done easier. The problem is that you are using this bit of code
slightly of topic. However you as already having discovered somehow need to convince the
linker to link in the lib. Since you are not referencing any exported symbols
this is the reason for not linking the lib in.

Without #pragma trickery this can be done in the following way:

extern "C" void tss_cleanup_implemented(void);

int main(int argc, char* argv[])
{
        tss_cleanup_implemented(); // just a dummy call to link the lib in
        printf("entering main\n");

        DWORD id;
        HANDLE h = CreateThread(NULL, 0, &f, 0, 0, &id);
        WaitForSingleObject(h, INFINITE);
        CloseHandle(h);

        _dummy = 0;

        printf("leaving main\n");

        return _dummy;
}

>
> Last thing that is working not quite as expected is that if I link to
> dynamic runtime CRT (/MD or /MDd), on_process_exit is not called. I will
> look into it later.

In the meantime I did all this sort of tests. I would be glad if you could confirm
this. I will post the details in a separate mail. However you will need to tweak
your local copy of boost since it seems Mike did not yet have time to check
everything into the CVS.

Roland


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk