_impure_ptr uninitialized in DLLs?

Fifer, Eric EFifer@sanwaint.com
Wed Jul 5 04:53:00 GMT 2000

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:


#include <stdio.h>

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


#include <stdio.h>

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


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


in d
      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:

in d
in d


Eric Fifer

More information about the Cygwin-developers mailing list