Linking pthread

Firstly sorry for posting the same subject also to bug report.
But I am not sure this is the bug of ROOT. So I post it again here.

I am going to use TThread in my analyzer. But compiled program crashs just after exitting from main(). Even following simple program reproduced the problem. It never happen with ROOT4.

On Linux when I moved -lpthread at the last, It worked.
It seems that libpthread.so is linked even without -lpthread option.
Can I remove -lpthread from Makefile ?

However on MacOSX, even I put -lpthread at the last or I remove this option, it does not work. Program does not stop with “return” or “exit(1)” in main(). I could stop program with “abort()”.

— Makefile —

[code]rootlibs := $(shell $(ROOTSYS)/bin/root-config --libs)
rootcflags := $(shell $(ROOTSYS)/bin/root-config --cflags)

test: main.cpp
g++ $(rootcflags) -o $@ $< -lpthread $(rootlibs) -lThread[/code]

— main.cpp —

[code]#include <Riostream.h>
#include <TThread.h>

void* TestLoop(void *arg)
{
return NULL;
}

int main(int argc, char *argv[])
{
TThread *thread = new TThread(“TestLoop”, TestLoop);

cout<<“OK”<<endl;
return 0;
} [/code]