1.15.19 dlopen() dies with no dlerror()

Michael McKerns mmckerns@its.caltech.edu
Tue Apr 11 20:38:00 GMT 2006


I've been using the following Makefile syntax with building cygwin
applications:

$(PROJ_DLL) $(PROJ_SAR): product_dirs $(PROJ_OBJS)
	$(CXX) $(LCXX_SARFLAGS) -Wl,--out-implib=$(PROJ_SAR) \
	-o $(PROJ_DLL) $(PROJ_OBJS) $(LCXXFLAGS)

This is exactly what is in the cygwin documentation, but generalized
for Makefiles.  It has succesfully generated executables since way
back, and was still working for cygwin 1.15.18-3, however since I've
upgraded to 1.15.19-4 it fails.

The behavior is this:
Output from compile and build steps produce the expected linking
messages.  No apparent errors.

However, applications die at dlopen.

Example (1):
importing a shared library (journal) through python
 $ python -v
 ...
 >>> import journal
 import journal # directory /home/mmckerns/tools/.../journal
 ...
 dlopen("/home/mmckerns/tools/.../_journalmodule.dll", 2);

python dies here, and exits with no error.
That lead me to writing a little test script to check the
behavior of the .dll in C (without python).

Example (2):
testing a shared library (journal) with dlopen & dlerror
 $ ./dlopen.exe
 .dll TEST...

the executable dies here, and exits with no error or print
(please see attached dlopen.c)


I have a feeling that this might be related to previous reports
(such as http://sourceware.org/ml/cygwin/2006-04/msg00073.html
 and http://sourceware.org/ml/cygwin/2006-04/msg00036.html),
but I am not sure.

---

Mike McKerns
California Institute of Technology
-------------- next part --------------
#include <stdio.h>
#include <dlfcn.h>

int main(int argc, char **argv) {
    void *handle;
//  double (*cosine)(double);
    char *error;

    fprintf (stdout, ".dll TEST...\n");
//  handle = dlopen("/home/mmckerns/tools/pythia-0.8/modules/arrayDemo/arrayDemomodule.dll", RTLD_LAZY);
    handle = dlopen("/home/mmckerns/tools/pythia-0.8/modules/journal/_journalmodule.dll", RTLD_LAZY);
    if (!handle) {
        fprintf (stderr, "%s\n", dlerror());
        exit(1);
    }
    fprintf (stdout, ".dll opened\n");

/*  cosine = dlsym(handle, "cos");
    if ((error = dlerror()) != NULL) {
        fprintf (stderr, "%s\n", error);
        exit(1);
    }

    printf ("%f\n", (*cosine)(2.0));
*/  dlclose(handle);
    fprintf (stdout, ".dll closed\n");
    return 0;
}

-------------- next part --------------
--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


More information about the Cygwin mailing list