This is the mail archive of the cygwin-developers@sources.redhat.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

_impure_ptr uninitialized in DLLs?



Starting with the Jul-01 snapshot, something changed
with the handling of _impure_ptr so that within a
newly compiled DLL its value is NULL.  Previously
compiled DLLs continue to work.  Presumably this
is related to the restructuring of user_data.

I'll try to hunt down the problem, but thought I
should report it in the meantime.

This is a demonstration of the problem:

d.c:

#include <stdio.h>

int __declspec(dllexport) d()
{
    printf("in d\n");
    printf("_impure_ptr=%x\n", _impure_ptr);
    fprintf(stdout, "in d\n");
}

m.c:

#include <stdio.h>

main() {
    printf("_impure_ptr=%x\n", _impure_ptr);
    d();
}

compile:

gcc -g -c d.c
dllwrap --output-lib libd.a --dllname libd.dll d.o
gcc -g -c m.c
gcc -o m m.o -L. -Wl,--Bstatic -ld -Wl,--Bdynamic

run:

_impure_ptr=6108c0c0
in d
_impure_ptr=0
      0 [main] m 1130 handle_exceptions: Exception: STATUS_ACCESS_VIOLATION
   8923 [main] m 1130 stackdump: Dumping stack trace to m.exe.stackdump

prior to Jul-01:

_impure_ptr=6108c0c0
in d
_impure_ptr=6108c0c0
in d

Thanks,

Eric Fifer




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]