I'm having a problem getting lazyload to work properly on Linux.
Here's a simple example to show what I'm seeing. Take the case of the
following
program:
#include <stdlib.h>
#include <stdio.h>
extern int so_fct(void);
int main() {
system("sleep 30");
printf("so_fct=%d",so_fct);
}
> gcc -o testx -L. -z lazyload -lx testx.c
The function so_fct is part of the libx.so shared library. According
to my understanding of things, libx shouldn't be loaded until the
so_fct is actually referenced. If I start this test program then
issue an "fuser -u libx.so" before the sleep expires, I get
libx.so: ####m(userid)
showing that libx has already loaded *before* the reference to so_fct
has occured. Isn't this counter to the way lazyload should work?
If I try this on a Solaris system, fuser shows that libx is not loaded
until so_fct is actually referenced, which is what I want.
Am I misunderstanding how Lazyload should be working? Is there
someway to resolve this (i.e. not have libx loaded until so_fct is
referenced)? I'm having the same problem on HP-UX, so perhaps Solaris
is the *only* system that properly implements lazyload???