bug-libtool
[Top][All Lists]
Advanced

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

lt_dlopenadvise ignores advice


From: Anton Ertl
Subject: lt_dlopenadvise ignores advice
Date: Fri, 18 Apr 2008 17:47:28 +0200 (CEST)

      host-triplet:     x86_64-unknown-linux-gnu
      shell:            /bin/sh
      compiler:         gcc
      compiler flags:           -g -O2
      linker:           /usr/bin/ld -m elf_x86_64 (gnu? yes)
      libtool:          (GNU libtool) 2.2.2
      automake:         automake (GNU automake) 1.9.6
      autoconf:         autoconf (GNU Autoconf) 2.61

The program below is a variation of the my_dlopenext example from the
manual.  Calling it with the correct extension works, but calling it
without extension does not:

[c8:~/tmp:15553] a.out libffi.so
0x501230
[c8:~/tmp:15554] a.out libffi   
my_dlopenext: file not found

If I replace the call of my_dlopenext with a call of lt_dlopenext, it
works as expected:

[c8:~/tmp:15556] a.out libffi
0x5012b0

I have also tested using lt_dladvise_global, and by looking at what
gets passed to dlopen (in gdb), this advice is ignored, too.  That's
actually a critical problem for me.

- anton

Here's the my_dlopenext example:

#include <ltdl.h>
#include <stdio.h>

lt_dlhandle
my_dlopenext (const char *filename)
{
  lt_dlhandle handle = 0;
  lt_dladvise advise;

  if (lt_dladvise_init (&advise)) {
    fprintf(stderr,"lt_dladvise_init: %s\n",lt_dlerror());
    exit(1);
  }

  if (lt_dladvise_ext (&advise)) {
     fprintf(stderr,"lt_dladvise_ext: %s\n",lt_dlerror());
    exit(1);
  }

  handle = lt_dlopenadvise (filename, &advise);

  lt_dladvise_destroy (&advise);

  return handle;
}

int main(int argc, char *argv[])
{
  if (lt_dlinit()!=0) {
    fprintf(stderr,"lt_dlinit: %s\n",lt_dlerror());
    exit(1);
  }
  lt_dlhandle x = my_dlopenext(argv[1]);
  if (x == NULL) {
    fprintf(stderr,"my_dlopenext: %s\n",lt_dlerror());
    exit(1);
  }
  printf("%p\n",x);
  return 0;
}







reply via email to

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