- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: dynamic library problem (shl_load)
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
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
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- 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
тАО06-02-2004 11:15 PM
тАО06-02-2004 11:15 PM
file1.c contains the main program and
some subroutines. file2.c contains subroutines only, which need to go into a shared library. I compile like this:
cc -Aa -c +z -g file2.c
ld -b -o libxyz.sl file2.o
cc -Aa -g file1.c -ldld
The mainprogram loads libxyz by means of shl_load.
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).
The dlopen method works, but that is not available on my system (HP-UX 10.20).
Any ideas what went wrong?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-02-2004 11:22 PM
тАО06-02-2004 11:22 PM
Re: dynamic library problem (shl_load)
Could you give the dld error message.
manish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-03-2004 01:22 AM
тАО06-03-2004 01:22 AM
Re: dynamic library problem (shl_load)
This is funny, because the missing subroutine had been linked statically.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-03-2004 03:46 AM
тАО06-03-2004 03:46 AM
Solutionextern int my_symbol;
does not allocate any storage for "my_symbol".
If you want the shared library to provide a
symbol you need to declare it as
int my_symbol;
somewhere in the shared library.
If you meant to declare a symbol in the a.out
and access it from the shared library, then
you may need to add a -Wl,-E option when
linking the a.out. That tells ld to export
all symbols for use by shared libraries even
if they are not used by code in the a.out
itself.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-03-2004 09:06 AM
тАО06-03-2004 09:06 AM
Re: dynamic library problem (shl_load)
"/usr/lib/dld.sl: Unresolved symbol: parse_global (code) from /home/ukd/architex
/lib/libbibliography.sl",
where parse_global() is a statically linked
subroutine (or rather, it is compiled together with main()).
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-03-2004 06:00 PM
тАО06-03-2004 06:00 PM
Re: dynamic library problem (shl_load)
the -E flag makes the linker export all symbols from a.out, that is how it fixed your problem.
--
ranga
[i work for hpe]