HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- shl_load function Problem
Operating System - HP-UX
1834020
Members
2718
Online
110063
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
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
10-19-2000 08:45 AM
10-19-2000 08:45 AM
shl_load function Problem
I am having libAmdOra.sl shared library. I wanted to access AmdOraStartup function which is inside that shared library.
FILENAME : TestLib.cpp
#include
#include
#include
#include
int main()
{
int status;
void *value;
shl_t shl_handle = shl_load("libAmdOra.sl",BIND_DEFERRED|DYNAMIC_PATH,0L);
if (shl_handle == NULL)
{
printf("shl_load error. rc = %sn", strerror(errno));
return -1;
}
printf("shl_load successn");
status = shl_findsym(&shl_handle, "AmdOraStartup", 0, value);
if (status == -1)
{
printf("findSym error. rc = %sn",strerror(errno));
return -1;
}
printf("findSym successn");
return 0;
}
I am working on HPUX11.0 machine & using aCC 3.15 compiler.
TESTDIR>aCC +DAportable TestLib.cpp -ldld
TESTDIR>a.out
/usr/lib/dld.sl: Can't shl_load() a library containing Thread Local Storage: /usr/lib/libpthread.1
/usr/lib/dld.sl: Exec format error
shl_load error. rc = Exec format error
----------------------
This shared library libAmdOra.sl contains all oracle related functions including AmdOraStartup function. made using -Z (compile) optio) and -b (link) option of aCC.
If anybody knows answer, please mail me.
Thank You
-Pravin
FILENAME : TestLib.cpp
#include
#include
#include
#include
int main()
{
int status;
void *value;
shl_t shl_handle = shl_load("libAmdOra.sl",BIND_DEFERRED|DYNAMIC_PATH,0L);
if (shl_handle == NULL)
{
printf("shl_load error. rc = %sn", strerror(errno));
return -1;
}
printf("shl_load successn");
status = shl_findsym(&shl_handle, "AmdOraStartup", 0, value);
if (status == -1)
{
printf("findSym error. rc = %sn",strerror(errno));
return -1;
}
printf("findSym successn");
return 0;
}
I am working on HPUX11.0 machine & using aCC 3.15 compiler.
TESTDIR>aCC +DAportable TestLib.cpp -ldld
TESTDIR>a.out
/usr/lib/dld.sl: Can't shl_load() a library containing Thread Local Storage: /usr/lib/libpthread.1
/usr/lib/dld.sl: Exec format error
shl_load error. rc = Exec format error
----------------------
This shared library libAmdOra.sl contains all oracle related functions including AmdOraStartup function. made using -Z (compile) optio) and -b (link) option of aCC.
If anybody knows answer, please mail me.
Thank You
-Pravin
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-20-2000 02:48 PM
10-20-2000 02:48 PM
Re: shl_load function Problem
The libAmdOra.sl library is linked against libpthread.sl.
The libpthread.sl library contains thread local storage variables.
The shl_load call can't bring in shared libraries that declare thread local storage variables.
You will need to link your a.out with at least libpthread.sl so it will be present before shl_load.
You can check what shared libraries are brought in by using "odump -sllibloadlist libAmdOra.sl". You can
check for the use of TLS in a shared library by using nm and grep to look for "$TBSS$" data-
# nm /usr/lib/libpthread.sl | grep TBSS
__self_pthread_d | 0|extern|data |$TBSS$
__self_pthread_t | 8|extern|data |$TBSS$
Thread local storage is discussed in "man pthread",
http://devresource.hp.com/STK/man/11.00/pthread_3t.html
and in "man shl_load",
http://devresource.hp.com/STK/man/11.00/shl_load_3x.html
==========================================================
The libpthread.sl library contains thread local storage variables.
The shl_load call can't bring in shared libraries that declare thread local storage variables.
You will need to link your a.out with at least libpthread.sl so it will be present before shl_load.
You can check what shared libraries are brought in by using "odump -sllibloadlist libAmdOra.sl". You can
check for the use of TLS in a shared library by using nm and grep to look for "$TBSS$" data-
# nm /usr/lib/libpthread.sl | grep TBSS
__self_pthread_d | 0|extern|data |$TBSS$
__self_pthread_t | 8|extern|data |$TBSS$
Thread local storage is discussed in "man pthread",
http://devresource.hp.com/STK/man/11.00/pthread_3t.html
and in "man shl_load",
http://devresource.hp.com/STK/man/11.00/shl_load_3x.html
==========================================================
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2000 04:14 AM
10-23-2000 04:14 AM
Re: shl_load function Problem
I think you are going to get a crash (in shl_findsym) after you get shl_load to return successfully.
Because you want shl_findsym( ) to output a pointer to the stated function (AmdOraStartup), you have to provide it the address of a location where it can write a pointer-to-the-function whose signature should be known. See the nice example in the HP-UX Linker and Libraries User's Guide:
http://docs.hp.com/cgi-bin/fsearch/framedisplay?top=/hpux/onlinedocs/B2355-90655/B2355-90655_top.html&con=/hpux/onlinedocs/B2355-90655/00/00/55-con.html&toc=/hpux/onlinedocs/B2355-90655/00/00/55-toc.html&searchterms=shl_findsym&queryid=20001023-045431
Kiran
Because you want shl_findsym( ) to output a pointer to the stated function (AmdOraStartup), you have to provide it the address of a location where it can write a pointer-to-the-function whose signature should be known. See the nice example in the HP-UX Linker and Libraries User's Guide:
http://docs.hp.com/cgi-bin/fsearch/framedisplay?top=/hpux/onlinedocs/B2355-90655/B2355-90655_top.html&con=/hpux/onlinedocs/B2355-90655/00/00/55-con.html&toc=/hpux/onlinedocs/B2355-90655/00/00/55-toc.html&searchterms=shl_findsym&queryid=20001023-045431
Kiran
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