Operating System - HP-UX
1827249 Members
3150 Online
109716 Solutions
New Discussion

need a way to link -mt and non -mt modules

 
Gurudutt Kumar V J
Occasional Contributor

need a way to link -mt and non -mt modules

Hi,
I am building a multithreaded application which links in a library which is single threaded. I am compiling my application with the -mt option but the single threaded library is not compiled with -mt. At runtime I encounter a crash. The stack trace is as below:
#0 0xc0213f60 in kill+0x10 () from /usr/lib/libc.2
#1 0xc01ab4f4 in raise+0x24 () from /usr/lib/libc.2
#2 0xc01f0c28 in abort_C+0x160 () from /usr/lib/libc.2
#3 0xc01f0c84 in abort+0x1c () from /usr/lib/libc.2
#4 0xc1ae3488 in std::terminate+0x38 () from /usr/lib/libCsup_v2.2
#5 0xc1ae3950 in ThrowException+0x74 () from /usr/lib/libCsup_v2.2
#6 0xc1ae3eb0 in __throw__FPvT1+0x14c () from /usr/lib/libCsup_v2.2
#7 0xc2c6cc48 in std::ios_base::setf+0x78 () from /usr/lib/libstd_v2.2
#8 0xc2c6c6f4 in std::ios_base::Init::Init+0x1e10 () from /usr/lib/libstd_v2.2
#9 0xc28f6cb8 in std::__sinit_arm_utf16_cpp+0x50 () from /vobs/hp11_pa_stage/stage/hp11_pa/pvtshlib/libncutil.sl
#10 0xc1ae56e8 in __shlInit+0x88 () from /usr/lib/libCsup_v2.2
#11 0xc28e740c in _shlInit+0x20 () from /vobs/hp11_pa_stage/stage/hp11_pa/pvtshlib/libncutil.sl
#12 0xc1ae5020 in __shlinit+0xac () from /usr/lib/libCsup_v2.2
#13 0xc1ae7584 in _main+0x194 () from /usr/lib/libCsup_v2.2

Is there a way that -mt and non -mt modules can be linked together at build and run-time.
1 REPLY 1
Dennis Handly
Acclaimed Contributor

Re: need a way to link -mt and non -mt modules

No, read the documentation. You must compile everything with -mt, if you are going to link with libpthread.