LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Simple Link problem (https://www.linuxquestions.org/questions/programming-9/simple-link-problem-390088/)

lucky6969b 12-07-2005 03:50 AM

Simple Link problem
 
I link my program with this
g++ -0 unittest unittest.cpp baseobject.cpp thread.cpp libthread.a

which results in Segmentation Fault when being run
on
pthread_create (&tid, NULL, &my_func, NULL);

Why there is seg fault when the linker did not complain?
I ran it thru the debugger, i found my_func to be not NULL and tid is 0, what is the problem? is it some dynamic library or static library link problems?
Thanks
Jack

graemef 12-07-2005 07:24 AM

tid needs to be set up to point to a valid memory address. pthread_create returns the tread id into this memory address.

graeme


All times are GMT -5. The time now is 05:03 AM.