multithread

P

Philipp Kraus

Hi,

I hope, that my topic is not off-topic.
I try to compile with g++ 4.0.1 a multithreaded library. On MS Visual
Studio I must set the crt-libs for multithreaded.
Do I need this for g++? Is there a falg (linker / compiler) for using
multithread?

Thanks

Phil
 
M

Marcel Müller

Hi,

Philipp said:
I hope, that my topic is not off-topic.
I try to compile with g++ 4.0.1 a multithreaded library. On MS Visual
Studio I must set the crt-libs for multithreaded.
Do I need this for g++? Is there a falg (linker / compiler) for using
multithread?

this is platform dependent, even with gcc. So there is no general answer.

You have to check informations about your platform or ask in a platform
related group.


Marcel
 
L

Lars Tetzlaff

Am 24.08.2010 11:32, schrieb Philipp Kraus:
Hi,

I hope, that my topic is not off-topic.
I try to compile with g++ 4.0.1 a multithreaded library. On MS Visual
Studio I must set the crt-libs for multithreaded.
Do I need this for g++? Is there a falg (linker / compiler) for using
multithread?

Thanks

Phil

On most Unixes (including Mac OSX) you have to use -pthread für
compiling and linking.

Lars
 
V

Victor Bazarov

I hope, that my topic is not off-topic.
I try to compile with g++ 4.0.1 a multithreaded library. On MS Visual
Studio I must set the crt-libs for multithreaded.
Do I need this for g++? Is there a falg (linker / compiler) for using
multithread?

Just to let you know, there is a hierarchy of newsgroups, whose name
stars with 'gnu.', for questions specific to those products. There is,
AFAIK, a subhierarchy 'gnu.g++.*', but I don't follow it closely to know
how useful (or useless) it might be.

And, generally speaking, questions on specific compilers, their options,
their libraries, command line format, etc., *are* off-topic.

V
 
J

Jorgen Grahn

Am 24.08.2010 11:32, schrieb Philipp Kraus:

On most Unixes (including Mac OSX) you have to use -pthread für
compiling and linking.

I don't know MacOS but I know the others, and I believe you're wrong.
You have to link with the Pthreads library (-lpthread) to use the
Pthreads functions, but there's nothing remarkable about that.

There was in the distant past a #define _REENTRANT which prepared the
C standard library for multithreaded use ... unsure which systems need
it today, but that's easy to google for.

/Jorgen
 
L

Lars Tetzlaff

Am 25.08.2010 09:38, schrieb Jorgen Grahn:
I don't know MacOS but I know the others, and I believe you're wrong.
You have to link with the Pthreads library (-lpthread) to use the
Pthreads functions, but there's nothing remarkable about that.

There was in the distant past a #define _REENTRANT which prepared the
C standard library for multithreaded use ... unsure which systems need
it today, but that's easy to google for.

/Jorgen

No, -pthread implies -lpthread but also switches the compiler to
threaded mode (i.e. errno is thread local).

From info g++:

`-pthread'
Adds support for multithreading with the "pthreads" library. This
option sets flags for both the preprocessor and linker.



Lars
 
J

Jorgen Grahn

Am 25.08.2010 09:38, schrieb Jorgen Grahn:

No, -pthread implies -lpthread but also switches the compiler to
threaded mode (i.e. errno is thread local).

From info g++:

`-pthread'
Adds support for multithreading with the "pthreads" library. This
option sets flags for both the preprocessor and linker.

Ah, sorry. I note though that that's an "IBM RS/6000 and PowerPC"
option, and also on SPARC. So I guess it boils down to what someone
else suggested: RTFM for your compiler, standard library and
architecture.

/Jorgen
 
M

Maxim Yegorushkin

I don't know MacOS but I know the others, and I believe you're wrong.
You have to link with the Pthreads library (-lpthread) to use the
Pthreads functions, but there's nothing remarkable about that.

With some compilers (don't remember whether it was gcc or Sun compiler)
linking explicitly with -lpthread meant using the old threads library,
as opposed to using -pthread or -mt for linking.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top