Operating System - HP-UX
1830749 Members
2009 Online
110015 Solutions
New Discussion

Question about LD_PRELOAD

 
Bernardo Pastorelli
Occasional Advisor

Question about LD_PRELOAD

The man page for dld.so contains the following note:

Note: Using LD_PRELOAD can cause a core dump when used with applications which mix shared and archived libraries, especially when both the shared library and the application are built with aC++ or use libc.

Can someone provide more insight in this? Or an example of such behavior? Even a piece of C source code that explains the problem is ok.

Thanks,
Bernardo.
1 REPLY 1
Steven Gillard_2
Honored Contributor

Re: Question about LD_PRELOAD

I suppose this situation would occur if your application was linked with an archive version of libc (for example), and you used LD_PRELOAD to load a library that was linked with the shared libc.sl. Some calls to libc functions would be resolved from the archive version, and others from the shared version. This is obviously an unsupported situation, worse if the libc.a you're linked with is a different rev to the libc.sl currently on your system.

There's a good discussion about the problems with mixing archived and shared libraries in the linker and libraries guide:

http://www.docs.hp.com/hpux/onlinedocs/B2355-90655/B2355-90655.html

See the section in the "Creating and using libraries" chapter.

Regards,
Steve