Operating System - HP-UX
1753867 Members
7580 Online
108809 Solutions
New Discussion

STL not working with shared library, same thing works if archive library is created.

 
hcl-chennai
Occasional Contributor

STL not working with shared library, same thing works if archive library is created.

The following code section works fine if make as a local funtion in the cpp. If same function made as part of the shared library, the string index operator is in a loop. Its continuously executing the statement sched_yield. Attached the sample test program.
----------------------------------------
void printsim(const std::string &str1)
{
for(int i=0;i{
char ch=str1[i];
if ( str1[i] == '-' )
continue;
else
printf("%c",ch);
}
}
------------------------------------
1 REPLY 1
Stephen Keane
Honored Contributor

Re: STL not working with shared library, same thing works if archive library is created.

Which compiler? I tried it with gcc and it works fine. I assume you are using aCC?

What does your makefile look like?