- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Library linkage between single threaded and multi ...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2012 10:36 AM
04-06-2012 10:36 AM
Library linkage between single threaded and multi threaded
I am trying to write an application on HP UX. I have couple of third party libraries which make use of multi threading. Rest all libraries are single threaded(compiled with no -mt option). Is there any issue if single threaded libraries/application binaries link to multi threaded binaries and vice versa? Do I get any issues during run/compile time? I read some where, that dlopen is not possible from single threaded libs for multi threaded ones.
Thank You
- Tags:
- pthread
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2012 10:42 AM - edited 04-06-2012 10:45 AM
04-06-2012 10:42 AM - edited 04-06-2012 10:45 AM
Re: Library linkage between single threaded and multi threaded
If you don't link with libpthread, it doesn't make a difference.
If you do, then every aC++ object must be compiled with -mt.
>that dlopen is not possible from single threaded libs for multi threaded ones.
If your shlib uses TLS, then you would have problems trying to dynamically load it on PA. For Integrity, the default is +tls=dynamic, so it should work fine.
- Tags:
- -mt
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2012 11:10 AM
04-06-2012 11:10 AM
Re: Library linkage between single threaded and multi threaded
Got point to of dlopen, we need to take care of TLS in app we are linking also.
bit confused with linkage between single thareded and multi threaded library, Ok, Assume I have 4 libST1, libST2, libST3 and libMT4, ST stands for single threaded and MT for multi threaded(uses pthreads) and an app binary AppST.sys. Now AppST links to libST1 and libST2, libST3 and libMT4 link to libST2. In this case do I need to build entire app as an Multi threaded, with -mt option? or does it work fine if I build libMT4 with -mt and rest without -mt option.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2012 12:11 PM - edited 04-06-2012 12:11 PM
04-06-2012 12:11 PM - edited 04-06-2012 12:11 PM
Re: Library linkage between single threaded and multi threaded
>MT for multi threaded (uses pthreads)
Does it really call pthread_create or is just thread safe?
>In this case do I need to build entire app as an Multi threaded
It's pretty simple. If you link with libpthread, EVERYTHING must be compiled with -mt.
(It doesn't matter which load module calls another.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2012 11:10 PM
04-06-2012 11:10 PM
Re: Library linkage between single threaded and multi threaded
Yes, libMT4, calls pthread_create and implements thread pool.!!
So you want to say entire build chain should be built with -mt, there is no way that we can omit -mt option for libs/app, even they are not making use of pthread_* set of APIs from the linked libMT library.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2012 11:21 PM
04-06-2012 11:21 PM
Re: Library linkage between single threaded and multi threaded
>libMT4, calls pthread_create and implements thread pool.
Unless this is optional, you're hosed.
>So you say entire build chain should be built with -mt, there is no way that we can omit -mt option for libs/app, even they are not making use of pthread_* set of APIs from the linked libMT library.
That's correct. The aC++ runtime for strings and iostream needs to be built consistently with -mt if you link in libpthread.
This code, if not called back from a thread, probably doesn't need to be changed to add locking. Unless their objects being passed to the threads.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2012 10:20 AM
04-07-2012 10:20 AM
Re: Library linkage between single threaded and multi threaded
Thank You Dennis,
cleared my doubts around multithreaded and single threaded library linkage.
One last help, can you point me any relevant docs from HP, which will be good reading around linkers and hp c/c++ compilers.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-08-2012 12:30 AM
04-08-2012 12:30 AM
Re: Library linkage between single threaded and multi threaded
>can you point me any relevant docs from HP, which will be good reading around linkers and HP C/C++ compilers.
http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/A.06.26_aCxx_Online%20Help/index.htm
Linker:
http://h20000.www2.hp.com/bc/docs/support/SupportManual/c02933546/c02933546.pdf?HPBCMETA::