Operating System - HP-UX
1831043 Members
2399 Online
110019 Solutions
New Discussion

Re: Shared library binding

 
Erich Hochmuth
Occasional Contributor

Shared library binding

I have a program that I link with the following options ???Wl,-B,deferred so the shared library binding should be put off until a symbol from the shared library is referenced. The first thing in my main source I call shl_load("path/to/my/library",BIND_IMMEDIATE,0L) to bind to my shared library. However, when I run my program the first thing it does is attempt to bind to my shared library, I get the following error:
/usr/lib/dld.sl: Can't find path for shared library: my_library_name
/usr/lib/dld.sl: No such file or directory
The program never executes a single line of my main source.
I???m using running on HPUX 10.20, is there something else that I need to do to put off shared library binding.
Thanks,
Erich
2 REPLIES 2
Jean-Luc Oudart
Honored Contributor

Re: Shared library binding

Would chatr on your program be the answer
man chatr

Jean-Luc
fiat lux
Mike Stroyan
Honored Contributor

Re: Shared library binding

The -B,deferred option does not control when a shared library is looked for. It controls when the addresses of called functions are determined. If you use the deferred mode then each function is looked up in the shared library symbol tables when the function is first called from an a.out or a particular shared library.
If you link a program with a shared library, then the shared library itself will need to be found at startup.
You can link a program without a shared library, then load the library with shl_load at runtime. You can then look up function addresses with shl_findsym. If you just call an extern function that is not linked in the compiler/linker will complain about the unresolved symbol. It will create a program file, but won't make it executable. It is possible to use "chmod +x" on that program and run it.