<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: creating static object in library causing application to crash in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/creating-static-object-in-library-causing-application-to-crash/m-p/4419686#M682292</link>
    <description>Step 3 is broken, you must link with g++, otherwise I get unsats on IPF.&lt;BR /&gt;&lt;BR /&gt;You are out of luck, g++ is broken and doesn't handle dlclose with destruction of function scope statics.  (I was using 4.2.1.)&lt;BR /&gt;&lt;BR /&gt;aCC6 is designed to handle it.</description>
    <pubDate>Thu, 14 May 2009 05:18:38 GMT</pubDate>
    <dc:creator>Dennis Handly</dc:creator>
    <dc:date>2009-05-14T05:18:38Z</dc:date>
    <item>
      <title>creating static object in library causing application to crash</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/creating-static-object-in-library-causing-application-to-crash/m-p/4419685#M682291</link>
      <description>Here is my scenario,&lt;BR /&gt;1. mylib.cpp contains the code for library libfoo.sl &lt;BR /&gt;2. main.cpp uses the above library using dlopen.&lt;BR /&gt;&lt;BR /&gt;mylib.cpp is attached and the main.cpp is like this &lt;BR /&gt;#include &lt;DLFCN.H&gt;&lt;BR /&gt;#include &lt;STDIO.H&gt;&lt;BR /&gt;#include &lt;UNISTD.H&gt;&lt;BR /&gt;typedef void (*f)(void) ;&lt;BR /&gt;int main()&lt;BR /&gt;{&lt;BR /&gt; void *handle = dlopen("/tmp/test/libfoo.sl",RTLD_NOW);&lt;BR /&gt; f cb = (f)dlsym(handle,"function");&lt;BR /&gt; cb();&lt;BR /&gt; dlclose(handle);&lt;BR /&gt; sleep(5);&lt;BR /&gt; return 0 ;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;and the command lines are as follows&lt;BR /&gt;1. g++ -g -Wall -c -fPIC -D_PSTAT_64 -DPTHREAD_COMPAT_MODE -DREENTRANT -D_REENTRANT  -o foo.o mylib.cpp &lt;BR /&gt;2. g++ -g -fPIC -shared -o libfoo.sl -lgcc_s -lstdc++ foo.o &lt;BR /&gt;3.gcc -g -Wl,-E main.cpp -o testexecutable &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;At the program exit there is a segmentation fault and the core is getting generated. Core is not telling much .&lt;BR /&gt;&lt;BR /&gt;May be some flags at compile time or  I am doing something really bad in code.&lt;BR /&gt;&lt;BR /&gt;If I remove the static inside the void tuctuc() then everything works fine. &lt;BR /&gt;&lt;BR /&gt;Any pointers will be appreciated.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Pramod&lt;BR /&gt;&lt;/UNISTD.H&gt;&lt;/STDIO.H&gt;&lt;/DLFCN.H&gt;</description>
      <pubDate>Thu, 14 May 2009 03:04:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/creating-static-object-in-library-causing-application-to-crash/m-p/4419685#M682291</guid>
      <dc:creator>pramodsharma</dc:creator>
      <dc:date>2009-05-14T03:04:55Z</dc:date>
    </item>
    <item>
      <title>Re: creating static object in library causing application to crash</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/creating-static-object-in-library-causing-application-to-crash/m-p/4419686#M682292</link>
      <description>Step 3 is broken, you must link with g++, otherwise I get unsats on IPF.&lt;BR /&gt;&lt;BR /&gt;You are out of luck, g++ is broken and doesn't handle dlclose with destruction of function scope statics.  (I was using 4.2.1.)&lt;BR /&gt;&lt;BR /&gt;aCC6 is designed to handle it.</description>
      <pubDate>Thu, 14 May 2009 05:18:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/creating-static-object-in-library-causing-application-to-crash/m-p/4419686#M682292</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2009-05-14T05:18:38Z</dc:date>
    </item>
    <item>
      <title>Re: creating static object in library causing application to crash</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/creating-static-object-in-library-causing-application-to-crash/m-p/4419687#M682293</link>
      <description>Thanks Denis. About this 3rd step we tried both gcc and g++ with the same result.&lt;BR /&gt;&lt;BR /&gt;Ya even I figured that out that somehow g++ has some issues here but your confirmation will definetly help. &lt;BR /&gt;&lt;BR /&gt;I am using gcc 4.0.1 so even moving to newer version is not going to help. Will recommend aCC to our team for next release.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 14 May 2009 06:17:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/creating-static-object-in-library-causing-application-to-crash/m-p/4419687#M682293</guid>
      <dc:creator>pramodsharma</dc:creator>
      <dc:date>2009-05-14T06:17:54Z</dc:date>
    </item>
    <item>
      <title>Re: creating static object in library causing application to crash</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/creating-static-object-in-library-causing-application-to-crash/m-p/4419688#M682294</link>
      <description>Our g++ expert says this is a known problem.  It is due to the differences in atexit(3) between libc on HP-UX and on Linux.</description>
      <pubDate>Fri, 15 May 2009 01:18:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/creating-static-object-in-library-causing-application-to-crash/m-p/4419688#M682294</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2009-05-15T01:18:31Z</dc:date>
    </item>
  </channel>
</rss>

