<?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 dlsym failure libxnet in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/dlsym-failure-libxnet/m-p/4042513#M743555</link>
    <description>Hi guys,&lt;BR /&gt;I put this chunk of code in a product I'm currently porting on HPUX 11.23 on Integrity&lt;BR /&gt;&lt;BR /&gt;dl_handle = dlopen ("libxnet.so", RTLD_LAZY);&lt;BR /&gt;  &lt;BR /&gt;if (!dl_handle) {&lt;BR /&gt; issue_trace(IOP_TRACE_CRITICAL, error in function dlopen libxnet.so %s", dlerror());&lt;BR /&gt;         return -1;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;issue_trace(IOP_TRACE_DEBUG, "libxnet.so loaded");&lt;BR /&gt; &lt;BR /&gt;xopen_getsockname = dlsym(dl_handle, "getsockname");&lt;BR /&gt;&lt;BR /&gt;issue_trace(IOP_TRACE_DEBUG, "extracting getsockname from libxnet.so"); &lt;BR /&gt;if ((dl_error = dlerror()) != NULL)  {&lt;BR /&gt; issue_trace(IOP_TRACE_CRITICAL, "error in function dlsym %s", dl_error);&lt;BR /&gt;        return -1;&lt;BR /&gt;}&lt;BR /&gt;issue_trace(IOP_TRACE_DEBUG, "getsockname extracted from libxnet.so");&lt;BR /&gt; }&lt;BR /&gt;when executing it I've get this message&lt;BR /&gt;&lt;BR /&gt;error in function dlsym Unable to find library '/usr/lib/nls/loc/hpux64/locales.1/C'&lt;BR /&gt;&lt;BR /&gt;I check the system and there is any file called /usr/lib/nls/loc/hpux64/locales.1/C&lt;BR /&gt;&lt;BR /&gt;but there are&lt;BR /&gt;&lt;BR /&gt;$ ls /usr/lib/nls/loc/hpux64/locales.1/C*&lt;BR /&gt;/usr/lib/nls/loc/hpux64/locales.1/C.iso88591&lt;BR /&gt;/usr/lib/nls/loc/hpux64/locales.1/C.iso885915&lt;BR /&gt;/usr/lib/nls/loc/hpux64/locales.1/C.utf8&lt;BR /&gt;&lt;BR /&gt;How could address this issue?&lt;BR /&gt;&lt;BR /&gt;Thanks in advance,&lt;BR /&gt;&lt;BR /&gt;Marco</description>
    <pubDate>Tue, 24 Jul 2007 06:11:56 GMT</pubDate>
    <dc:creator>Marco Salvi</dc:creator>
    <dc:date>2007-07-24T06:11:56Z</dc:date>
    <item>
      <title>dlsym failure libxnet</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/dlsym-failure-libxnet/m-p/4042513#M743555</link>
      <description>Hi guys,&lt;BR /&gt;I put this chunk of code in a product I'm currently porting on HPUX 11.23 on Integrity&lt;BR /&gt;&lt;BR /&gt;dl_handle = dlopen ("libxnet.so", RTLD_LAZY);&lt;BR /&gt;  &lt;BR /&gt;if (!dl_handle) {&lt;BR /&gt; issue_trace(IOP_TRACE_CRITICAL, error in function dlopen libxnet.so %s", dlerror());&lt;BR /&gt;         return -1;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;issue_trace(IOP_TRACE_DEBUG, "libxnet.so loaded");&lt;BR /&gt; &lt;BR /&gt;xopen_getsockname = dlsym(dl_handle, "getsockname");&lt;BR /&gt;&lt;BR /&gt;issue_trace(IOP_TRACE_DEBUG, "extracting getsockname from libxnet.so"); &lt;BR /&gt;if ((dl_error = dlerror()) != NULL)  {&lt;BR /&gt; issue_trace(IOP_TRACE_CRITICAL, "error in function dlsym %s", dl_error);&lt;BR /&gt;        return -1;&lt;BR /&gt;}&lt;BR /&gt;issue_trace(IOP_TRACE_DEBUG, "getsockname extracted from libxnet.so");&lt;BR /&gt; }&lt;BR /&gt;when executing it I've get this message&lt;BR /&gt;&lt;BR /&gt;error in function dlsym Unable to find library '/usr/lib/nls/loc/hpux64/locales.1/C'&lt;BR /&gt;&lt;BR /&gt;I check the system and there is any file called /usr/lib/nls/loc/hpux64/locales.1/C&lt;BR /&gt;&lt;BR /&gt;but there are&lt;BR /&gt;&lt;BR /&gt;$ ls /usr/lib/nls/loc/hpux64/locales.1/C*&lt;BR /&gt;/usr/lib/nls/loc/hpux64/locales.1/C.iso88591&lt;BR /&gt;/usr/lib/nls/loc/hpux64/locales.1/C.iso885915&lt;BR /&gt;/usr/lib/nls/loc/hpux64/locales.1/C.utf8&lt;BR /&gt;&lt;BR /&gt;How could address this issue?&lt;BR /&gt;&lt;BR /&gt;Thanks in advance,&lt;BR /&gt;&lt;BR /&gt;Marco</description>
      <pubDate>Tue, 24 Jul 2007 06:11:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/dlsym-failure-libxnet/m-p/4042513#M743555</guid>
      <dc:creator>Marco Salvi</dc:creator>
      <dc:date>2007-07-24T06:11:56Z</dc:date>
    </item>
    <item>
      <title>Re: dlsym failure libxnet</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/dlsym-failure-libxnet/m-p/4042514#M743556</link>
      <description>&lt;!--!*#--&gt;Your code is broken.  It is illegal to call dlerror() unless you have an error.  Exactly the same as errno(3) and perror(3).&lt;BR /&gt;&lt;BR /&gt;Your first call to dlerror(3) is fine, you're checking dl_handle.&lt;BR /&gt;&lt;BR /&gt;But your second call to dlerror(3) is broken, you are printing a "stale" message, and worst of all, you are aborting.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;when executing it I've get this message&lt;BR /&gt;error in function dlsym Unable to find library '/usr/lib/nls/loc/hpux64/locales.1/C'&lt;BR /&gt;&lt;BR /&gt;You got this because setlocale(3) was called and that "C" locale never exists.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;How could address this issue?&lt;BR /&gt;&lt;BR /&gt;The correct check is:&lt;BR /&gt;if (!xopen_getsockname) {&lt;BR /&gt;   issue_trace(IOP_TRACE_CRITICAL, "error in function dlsym %s", dlerror());</description>
      <pubDate>Tue, 24 Jul 2007 23:12:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/dlsym-failure-libxnet/m-p/4042514#M743556</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-07-24T23:12:39Z</dc:date>
    </item>
    <item>
      <title>Re: dlsym failure libxnet</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/dlsym-failure-libxnet/m-p/4042515#M743557</link>
      <description>Thank you for your answer. I noticed that the dlsym was working despite the error. I used the code that I found there as inspiration &lt;A href="http://linux.about.com/library/cmd/blcmdl3_dlsym.htm" target="_blank"&gt;http://linux.about.com/library/cmd/blcmdl3_dlsym.htm&lt;/A&gt; &lt;BR /&gt;&lt;BR /&gt;Maybe on linux the behaviour is different or is&lt;BR /&gt;an error also on that OS?&lt;BR /&gt;</description>
      <pubDate>Wed, 25 Jul 2007 03:55:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/dlsym-failure-libxnet/m-p/4042515#M743557</guid>
      <dc:creator>Marco Salvi</dc:creator>
      <dc:date>2007-07-25T03:55:45Z</dc:date>
    </item>
    <item>
      <title>Re: dlsym failure libxnet</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/dlsym-failure-libxnet/m-p/4042516#M743558</link>
      <description>&amp;gt;I used the code that I found there as inspiration &lt;A href="http://linux.about.com/library/cmd/blcmdl3_dlsym.htm" target="_blank"&gt;http://linux.about.com/library/cmd/blcmdl3_dlsym.htm&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Well, I would say it is broken.  It depends if you got any dl errors that you didn't call dlerror(3).  Reading carefully indicates the whole dlsym(3) interface is broken!&lt;BR /&gt;&lt;BR /&gt;There are an awfully lots of words there that explain how you can't trust the return from dlsym(3) being NULL and why you have to call dlerror(3).&lt;BR /&gt;&lt;BR /&gt;It seems that in addition to the thesis that is there, it should also mention that you must call dlerror(3) BEFORE you call dlsym(3) so you can reset the error.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;Maybe on linux the behaviour is different or is an error also on that OS?&lt;BR /&gt;&lt;BR /&gt;Perhaps setlocale(3) isn't sloppy on linux?&lt;BR /&gt;&lt;BR /&gt;Anyway, on HP-UX, testing the dlsym result for NULL should be all you need.</description>
      <pubDate>Wed, 25 Jul 2007 04:40:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/dlsym-failure-libxnet/m-p/4042516#M743558</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-07-25T04:40:31Z</dc:date>
    </item>
  </channel>
</rss>

