libtool
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

dlopen on Solaris compared with IRIX/Tru64


From: Albert Chin-A-Young
Subject: dlopen on Solaris compared with IRIX/Tru64
Date: Wed, 20 Dec 2000 00:00:52 -0600
User-agent: Mutt/1.1.12i

This is not a libtool-specific question but has some relation to ltdl.

I'm trying to dlopen two libraries without compiling with -R or
running the executable with LD_LIBRARY_PATH set. The libraries are
libpng.so and libz.so. libpng.so is dependent on libz.so. libz.so is
dependent on nothing:
  $ ldd libpng.so
  libz.so.2 =>     (file not found)
  libm.so.1 =>     /usr/lib/libm.so.1
  libc.so.1 =>     /usr/lib/libc.so.1
  libdl.so.1 =>    /usr/lib/libdl.so.1
  $ ldd libz.so
  libc.so.1 =>     /usr/lib/libc.so.1
  libdl.so.1 =>    /usr/lib/libdl.so.1

I wrote the following program to load libz.so first then libpng.so,
thinking the symbols loaded in from libz.so would be used by
libpng.so:

  #include <stdio.h>
  #include <dlfcn.h>

  int
  main (void) {
    void *h1, *h2;
                  
    h1 = dlopen ("libz.so", RTLD_NOW | RTLD_GLOBAL);
    if (!h1) {                                      
      puts (dlerror ());
      exit (1);         
    }          
    puts ("libz.so loaded");
                            
    h2 = dlopen ("libpng.so", RTLD_NOW | RTLD_GLOBAL);
    if (!h2) {                                        
      puts (dlerror ());
      exit (1);         
    }          
    puts ("libpng.so loaded");

    dlclose (h2);
    dlclose (h1);
  }
   
  $ cc a.c -ldl
  $ ./a.out
  libz.so loaded
  ld.so.1: ./a.out: fatal: libz.so.2: open failed: No such file or
  directory

This program works just fine on IRIX 6.5 and Compaq Tru64 UNIX 5.0.
The failure above is on Solaris 2.5.1-8/SPARC.

Is it possible to tell Solaris to try and resolve all symbols before
trying to load in dependent libraries? If not, what advantages does
ltdl bring to the table on Solaris for automatically loading in
dependency libraries? I don't see how it can get around this problem.

-- 
albert chin (address@hidden)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]