[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: pthreads
From: |
Paul Pluzhnikov |
Subject: |
Re: pthreads |
Date: |
02 Aug 2004 21:27:50 -0700 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Artificial Intelligence) |
Matthew Polder <matthewtunapolder@kodak.com> writes:
> You are correct, I am linking statically. I did look in /usr/lib and saw
> libpthread.so, so I guess I will need to start building dynamic
> libraries (I have successfully avoided it up to this point).
[Please do not top-post].
You don't have to build dynamic libraries in order to have a
dynamically-linked executable. Your "old" archive libraries will
work just fine, e.g.
gcc -c foo.c; gcc -c bar.c; ar rv libfoobar.a foo.o bar.o
gcc -o foobar.exe main.c -L. -lfoobar -pthreads
[The last command uses archive libfoobar.a and dynamic libpthread.so]
> However, before using gcc, I was using Sun's C++ compiler, CC. With this
> compiler I was able to link statically and have my threads work. I used
> the '-mt' flag in compiling and linking and it took care of everything.
> I wonder what library it used.
It used /usr/lib/libpthread.so. Your mistake is that you assumed
for some reason that you need -static. You don't.
> Since =pthreads is not really documented in the gcc manual, is there
> another reference where one can learn these things?
Well, "man pthread" and searching docs.sun.com would be a start.
Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
- Re: pthreads, Matthew Polder, 2004/08/02
- Re: pthreads,
Paul Pluzhnikov <=