This is the mail archive of the
cygwin-developers@sources.redhat.com
mailing list for the Cygwin project.
_impure_ptr uninitialized in DLLs?
- To: cygwin-developers at sourceware dot cygnus dot com
- Subject: _impure_ptr uninitialized in DLLs?
- From: "Fifer, Eric" <EFifer at sanwaint dot com>
- Date: Wed, 5 Jul 2000 12:50:29 +0100
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