This is the mail archive of the
cygwin-developers@sources.redhat.com
mailing list for the Cygwin project.
Re: _impure_ptr uninitialized in DLLs?
- To: "'cygwin-developers at sourceware dot cygnus dot com'" <cygwin-developers at sourceware dot cygnus dot com>
- Subject: Re: _impure_ptr uninitialized in DLLs?
- From: Chris Faylor <cgf at cygnus dot com>
- Date: Wed, 12 Jul 2000 00:05:02 -0400
- References: <779F20BCCE5AD31186A50008C75D9979171745@silldn_mail1.sanwaint.com>
- Reply-To: cygwin-developers at sourceware dot cygnus dot com
This should be fixed in CVS now. It will require updating libcygwin.a.
cgf
On Tue, Jul 11, 2000 at 06:41:47PM +0100, Fifer, Eric wrote:
>
>>I've checked in a fix for this. It was pretty tricky. Let's see if I
>>actually got it right.
>
>_impure_ptr seems to be working fine now. Thanks.
>
>Unfortunately now, another problem is that environ seems to get clobbered
>by a dlopen(), so getenv() generates a STATUS_ACCESS_VIOLATION
>at environ.cc:152 (my_findenv).
>
>Again, I'll try to hunt down the problem, but I thought I
>should report it in the meantime.
>
>Here's the demonstration of the problem:
>
>d.c:
>
>#include <unistd.h>
>
>int __declspec(dllexport) d()
>{
> printf("in d\n");
> printf("environ=%x\n", environ);
>}
>
>m.c:
>
>#include <dlfcn.h>
>#include <unistd.h>
>
>main() {
> void *libref;
> int (*symref)();
>
> printf("environ=%x\n", environ);
> printf("PATH=%s\n", getenv("PATH"));
>
> libref = dlopen("libd.dll", RTLD_LAZY);
> symref = dlsym(libref, "d");
> symref();
>
> printf("environ=%x\n", environ);
> printf("PATH=%s\n", getenv("PATH"));
>}
>
>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
>
>run:
>
>PATH=/bin:/usr/local/bin:.
>in d
>environ=0
>environ=a040008
> 0 [main] m 1213 handle_exceptions: Exception: STATUS_ACCESS_VIOLATION
> 13162 [main] m 1213 stackdump: Dumping stack trace to m.exe.stackdump
>
>prior to Jul-01:
>
>environ=a040008
>PATH=/bin:/usr/local/bin:.
>in d
>environ=a040008
>environ=a040008
>PATH=/bin:/usr/local/bin:.
>
>Thanks,
>
>Eric Fifer
--
cgf@cygnus.com Cygnus Solutions, a Red Hat company
http://sourceware.cygnus.com/ http://www.redhat.com/