<?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: dynamic library problem (shl_load) in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/dynamic-library-problem-shl-load/m-p/3294775#M715697</link>
    <description>A declaration like&lt;BR /&gt;    extern int my_symbol;&lt;BR /&gt;does not allocate any storage for "my_symbol".&lt;BR /&gt;If you want the shared library to provide a&lt;BR /&gt;symbol you need to declare it as&lt;BR /&gt;    int my_symbol;&lt;BR /&gt;somewhere in the shared library.&lt;BR /&gt;&lt;BR /&gt;If you meant to declare a symbol in the a.out&lt;BR /&gt;and access it from the shared library, then&lt;BR /&gt;you may need to add a -Wl,-E option when&lt;BR /&gt;linking the a.out.  That tells ld to export&lt;BR /&gt;all symbols for use by shared libraries even&lt;BR /&gt;if they are not used by code in the a.out&lt;BR /&gt;itself.</description>
    <pubDate>Thu, 03 Jun 2004 10:46:27 GMT</pubDate>
    <dc:creator>Mike Stroyan</dc:creator>
    <dc:date>2004-06-03T10:46:27Z</dc:date>
    <item>
      <title>dynamic library problem (shl_load)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/dynamic-library-problem-shl-load/m-p/3294772#M715694</link>
      <description>Condider the following case:&lt;BR /&gt;file1.c contains the main program and&lt;BR /&gt;some subroutines. file2.c contains subroutines only, which need to go into a shared library. I compile like this:&lt;BR /&gt;cc -Aa -c +z -g file2.c&lt;BR /&gt;ld -b -o libxyz.sl file2.o&lt;BR /&gt;cc -Aa -g file1.c -ldld&lt;BR /&gt;The mainprogram loads libxyz by means of shl_load.&lt;BR /&gt;If I run a.out and file2.c contains external variables (extern int something ...), the shl_findsym fails. Without external variables the subroutines from file2 are loaded correctly - but then it is not possible to invoke a subroutine from file1 any longer (dld error).&lt;BR /&gt;&lt;BR /&gt;The dlopen method works, but that is not available on my system (HP-UX 10.20).&lt;BR /&gt;&lt;BR /&gt;Any ideas what went wrong?</description>
      <pubDate>Thu, 03 Jun 2004 06:15:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/dynamic-library-problem-shl-load/m-p/3294772#M715694</guid>
      <dc:creator>Ulrich Deiters</dc:creator>
      <dc:date>2004-06-03T06:15:14Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic library problem (shl_load)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/dynamic-library-problem-shl-load/m-p/3294773#M715695</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Could you give the dld error message.&lt;BR /&gt;&lt;BR /&gt;manish</description>
      <pubDate>Thu, 03 Jun 2004 06:22:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/dynamic-library-problem-shl-load/m-p/3294773#M715695</guid>
      <dc:creator>Manish Srivastava</dc:creator>
      <dc:date>2004-06-03T06:22:01Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic library problem (shl_load)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/dynamic-library-problem-shl-load/m-p/3294774#M715696</link>
      <description>... something like "dld error, symbol &lt;NAME of="" some="" subroutine=""&gt; not found.&lt;BR /&gt;&lt;BR /&gt;This is funny, because the missing subroutine had been linked statically.&lt;/NAME&gt;</description>
      <pubDate>Thu, 03 Jun 2004 08:22:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/dynamic-library-problem-shl-load/m-p/3294774#M715696</guid>
      <dc:creator>Ulrich Deiters</dc:creator>
      <dc:date>2004-06-03T08:22:20Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic library problem (shl_load)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/dynamic-library-problem-shl-load/m-p/3294775#M715697</link>
      <description>A declaration like&lt;BR /&gt;    extern int my_symbol;&lt;BR /&gt;does not allocate any storage for "my_symbol".&lt;BR /&gt;If you want the shared library to provide a&lt;BR /&gt;symbol you need to declare it as&lt;BR /&gt;    int my_symbol;&lt;BR /&gt;somewhere in the shared library.&lt;BR /&gt;&lt;BR /&gt;If you meant to declare a symbol in the a.out&lt;BR /&gt;and access it from the shared library, then&lt;BR /&gt;you may need to add a -Wl,-E option when&lt;BR /&gt;linking the a.out.  That tells ld to export&lt;BR /&gt;all symbols for use by shared libraries even&lt;BR /&gt;if they are not used by code in the a.out&lt;BR /&gt;itself.</description>
      <pubDate>Thu, 03 Jun 2004 10:46:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/dynamic-library-problem-shl-load/m-p/3294775#M715697</guid>
      <dc:creator>Mike Stroyan</dc:creator>
      <dc:date>2004-06-03T10:46:27Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic library problem (shl_load)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/dynamic-library-problem-shl-load/m-p/3294776#M715698</link>
      <description>The exact error message was&lt;BR /&gt;"/usr/lib/dld.sl: Unresolved symbol: parse_global (code) from /home/ukd/architex&lt;BR /&gt;/lib/libbibliography.sl",&lt;BR /&gt;where parse_global() is a statically linked&lt;BR /&gt;subroutine (or rather, it is compiled together with main()).&lt;BR /&gt;&lt;BR /&gt;I do not quite understand why the program forgets its static subroutine table. But whatever the reason is,"-Wl,-E" did the trick! Thank you for your help.&lt;BR /&gt;</description>
      <pubDate>Thu, 03 Jun 2004 16:06:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/dynamic-library-problem-shl-load/m-p/3294776#M715698</guid>
      <dc:creator>Ulrich Deiters</dc:creator>
      <dc:date>2004-06-03T16:06:50Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic library problem (shl_load)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/dynamic-library-problem-shl-load/m-p/3294777#M715699</link>
      <description>by default, symbols are not exported from the application program ('a.out') unless they are being imported by a shared library seen at link-time (not one that may dynamically loaded by the user). so in your case the precise solution is to add this to your compile line : '-Wl,+ee,parse_global'&lt;BR /&gt;&lt;BR /&gt;the -E flag makes the linker export all symbols from a.out, that is how it fixed your problem.</description>
      <pubDate>Fri, 04 Jun 2004 01:00:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/dynamic-library-problem-shl-load/m-p/3294777#M715699</guid>
      <dc:creator>ranganath ramachandra</dc:creator>
      <dc:date>2004-06-04T01:00:27Z</dc:date>
    </item>
  </channel>
</rss>

