bug-glibc
[Top][All Lists]
Advanced

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

dlopen( NULL,) problem


From: Olaf Flebbe
Subject: dlopen( NULL,) problem
Date: Fri, 07 Nov 2003 10:43:45 +0100
User-agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)

Hi,

compile the attached code (cc a.c -ldl) and let it run.

I would expect the output
bla
bla
On IRIX, Solaris, HPUX iA64 (with their proprietary libc/libdl) this code works as expected.

On Linux/ix86 (RedHat and Suse) I get:
bla
./a.out: undefined symbol: bla

Tested it with glibc 2.3.2 and glibc 2.2.x

Greetings
  Olaf

BTW: AIX seems to be Linux compatible ;-)
--
________________________________creating IT solutions
Dr. Olaf Flebbe                 science + computing ag
Leiter Softwareentwicklung      Hagellocher Weg 71-75
phone +49 7071 9457 254         72070 Tuebingen, Germany
fax   +49 7071 9457 511         www.science-computing.de
#include <dlfcn.h>
#include <stdio.h>
void
bla() {
  printf("bla\n");
}

typedef  void (*func_ptr)();

int main(int argc, char *argv[]) {
  void *func;
  void *handle = dlopen( NULL, RTLD_LAZY);

  bla();
  func = dlsym( handle, "bla" );
  
  if (func)
    (*(func_ptr) func)();
  else
    printf( "%s\n", dlerror());
}

reply via email to

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