I'm trying to dlopen a .dll which depends on another .dll, and am getting a "Win32 error 127". I'm not totally sure I am building the dll's correctly, so that might be one source of the problem. This is with Cygwin version 1.3.10, gcc version 2.95.3-5, dlltool version 2.11.92, and Windows NT 4.0.
Here is an example. There are 3 source files: m.c, a.c, and b.c. a.c is used to build a.dll, which m.exe can dlopen without problems. However, b.c is used to build b.dll, but this depends on symbols in a.dll. m.exe gets an error upon trying to dlopen b.dll. ------------------------m.c-------------------------------------------- #include <stdio.h> #include <dlfcn.h> #include <stdlib.h> main () { void *a_handle, *b_handle; void (*a)(), (*b)(); if ((a_handle = dlopen("a.dll", RTLD_NOW)) == NULL) { printf("dlopen of a.dll failed: %s\n", dlerror()); exit(1); } if ((a = (void (*)()) dlsym(a_handle, "a")) == NULL) { printf("dlsym of a failed: %s\n", dlerror()); exit(1); } (*a)(); if ((b_handle = dlopen("b.dll", RTLD_NOW)) == NULL) { printf("dlopen of b.dll failed: %s\n", dlerror()); exit(1); } if ((b = (void (*)()) dlsym(b_handle, "b")) == NULL) { printf("dlsym of b failed: %s\n", dlerror()); exit(1); } (*b)(); } ------------------------end of m.c------------------------------------- ------------------------a.c-------------------------------------------- #include <stdio.h> void a() { printf("a called.\n"); } ------------------------end of a.c------------------------------------- ------------------------b.c-------------------------------------------- #include "stdio.h" extern void a(); void b() { printf("b called.\n"); a(); } ------------------------end of b.c------------------------------------- I compile and run these with the following commands: gcc -g -c -o m.o m.c gcc -g -c -o a.o a.c gcc -shared -o a.dll a.o gcc -g -c -o b.o b.c echo EXPORTS > a.def nm a.dll | grep ' T _' | sed 's/.* T _//' >> a.def dlltool --def a.def --dllname a.dll --output-lib a.a gcc -shared -o b.dll b.o a.a gcc -g -o m.exe m.o ./m.exe a called. dlopen of b.dll failed: dlopen: Win32 error 127 Any idea what is going wrong, or what else to try? Thanks. --Greg Hood Pittsburgh Supercomputing Center -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/