help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: pthreads


From: Paul Pluzhnikov
Subject: Re: pthreads
Date: 30 Jul 2004 22:24:13 -0700
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Artificial Intelligence)

Matthew Polder <matthewtunapolder@kodak.com> writes:

> I'm using gcc 3.3 on a SunOS 5.8 machine. I have a library that I've
> made static. One of the files in the library uses pthreads. I compile
> this library using 'g++ -pthreads ...' and then use -static to make the
> library. 

The 'g++ -static' doesn't make a static library.
It makes a statically linked executable, which can not be used in
further links. This makes your description of what you are actually
doing quite difficult to believe.

> gcc is configured to used /usr/ccs/bin/ld as the linker, and I
> use ar to make the library. Then I have a file that I compile with the
> same flags and link it with the library with pthreads. 
> 
> It links fine, but when it gets to the thread part of the program, it
> doesn't execute them. 

This behaviour is often the case when libpthread.so is not linked
into the executable: on Solaris libc.so provides 'stubs' for all
(most?) of pthread_.... functions, and these stubs always return
an error.

I gather you are not checking pthread_create() for error return.
You should.

> I've tried using -pthreads on the link line but

That's the right way to do it.

> then it complains about not finding the pthreads library (I'm not sure
> where it is).

That is even harder to believe, since on Solaris 5.8 libpthread.so
is installed in /usr/lib by default.

Cheers,
-- 
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]