HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: dlsym failure libxnet
Operating System - HP-UX
1832856
Members
3132
Online
110047
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2007 11:11 PM
07-23-2007 11:11 PM
Hi guys,
I put this chunk of code in a product I'm currently porting on HPUX 11.23 on Integrity
dl_handle = dlopen ("libxnet.so", RTLD_LAZY);
if (!dl_handle) {
issue_trace(IOP_TRACE_CRITICAL, error in function dlopen libxnet.so %s", dlerror());
return -1;
}
issue_trace(IOP_TRACE_DEBUG, "libxnet.so loaded");
xopen_getsockname = dlsym(dl_handle, "getsockname");
issue_trace(IOP_TRACE_DEBUG, "extracting getsockname from libxnet.so");
if ((dl_error = dlerror()) != NULL) {
issue_trace(IOP_TRACE_CRITICAL, "error in function dlsym %s", dl_error);
return -1;
}
issue_trace(IOP_TRACE_DEBUG, "getsockname extracted from libxnet.so");
}
when executing it I've get this message
error in function dlsym Unable to find library '/usr/lib/nls/loc/hpux64/locales.1/C'
I check the system and there is any file called /usr/lib/nls/loc/hpux64/locales.1/C
but there are
$ ls /usr/lib/nls/loc/hpux64/locales.1/C*
/usr/lib/nls/loc/hpux64/locales.1/C.iso88591
/usr/lib/nls/loc/hpux64/locales.1/C.iso885915
/usr/lib/nls/loc/hpux64/locales.1/C.utf8
How could address this issue?
Thanks in advance,
Marco
I put this chunk of code in a product I'm currently porting on HPUX 11.23 on Integrity
dl_handle = dlopen ("libxnet.so", RTLD_LAZY);
if (!dl_handle) {
issue_trace(IOP_TRACE_CRITICAL, error in function dlopen libxnet.so %s", dlerror());
return -1;
}
issue_trace(IOP_TRACE_DEBUG, "libxnet.so loaded");
xopen_getsockname = dlsym(dl_handle, "getsockname");
issue_trace(IOP_TRACE_DEBUG, "extracting getsockname from libxnet.so");
if ((dl_error = dlerror()) != NULL) {
issue_trace(IOP_TRACE_CRITICAL, "error in function dlsym %s", dl_error);
return -1;
}
issue_trace(IOP_TRACE_DEBUG, "getsockname extracted from libxnet.so");
}
when executing it I've get this message
error in function dlsym Unable to find library '/usr/lib/nls/loc/hpux64/locales.1/C'
I check the system and there is any file called /usr/lib/nls/loc/hpux64/locales.1/C
but there are
$ ls /usr/lib/nls/loc/hpux64/locales.1/C*
/usr/lib/nls/loc/hpux64/locales.1/C.iso88591
/usr/lib/nls/loc/hpux64/locales.1/C.iso885915
/usr/lib/nls/loc/hpux64/locales.1/C.utf8
How could address this issue?
Thanks in advance,
Marco
Solved! Go to Solution.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2007 04:12 PM
07-24-2007 04:12 PM
Solution
Your code is broken. It is illegal to call dlerror() unless you have an error. Exactly the same as errno(3) and perror(3).
Your first call to dlerror(3) is fine, you're checking dl_handle.
But your second call to dlerror(3) is broken, you are printing a "stale" message, and worst of all, you are aborting.
>when executing it I've get this message
error in function dlsym Unable to find library '/usr/lib/nls/loc/hpux64/locales.1/C'
You got this because setlocale(3) was called and that "C" locale never exists.
>How could address this issue?
The correct check is:
if (!xopen_getsockname) {
issue_trace(IOP_TRACE_CRITICAL, "error in function dlsym %s", dlerror());
Your first call to dlerror(3) is fine, you're checking dl_handle.
But your second call to dlerror(3) is broken, you are printing a "stale" message, and worst of all, you are aborting.
>when executing it I've get this message
error in function dlsym Unable to find library '/usr/lib/nls/loc/hpux64/locales.1/C'
You got this because setlocale(3) was called and that "C" locale never exists.
>How could address this issue?
The correct check is:
if (!xopen_getsockname) {
issue_trace(IOP_TRACE_CRITICAL, "error in function dlsym %s", dlerror());
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2007 08:55 PM
07-24-2007 08:55 PM
Re: dlsym failure libxnet
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 http://linux.about.com/library/cmd/blcmdl3_dlsym.htm
Maybe on linux the behaviour is different or is
an error also on that OS?
Maybe on linux the behaviour is different or is
an error also on that OS?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2007 09:40 PM
07-24-2007 09:40 PM
Re: dlsym failure libxnet
>I used the code that I found there as inspiration http://linux.about.com/library/cmd/blcmdl3_dlsym.htm
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!
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).
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.
>Maybe on linux the behaviour is different or is an error also on that OS?
Perhaps setlocale(3) isn't sloppy on linux?
Anyway, on HP-UX, testing the dlsym result for NULL should be all you need.
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!
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).
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.
>Maybe on linux the behaviour is different or is an error also on that OS?
Perhaps setlocale(3) isn't sloppy on linux?
Anyway, on HP-UX, testing the dlsym result for NULL should be all you need.
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP