Mailing-List: contact cygwin-developers-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-developers-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin-developers AT sources DOT redhat DOT com Message-ID: <779F20BCCE5AD31186A50008C75D9979171745@silldn_mail1.sanwaint.com> From: "Fifer, Eric" To: "'cygwin-developers AT sourceware DOT cygnus DOT com'" Subject: RE: _impure_ptr uninitialized in DLLs? Date: Tue, 11 Jul 2000 18:41:47 +0100 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2650.21) Content-Type: text/plain; charset="iso-8859-1" >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 int __declspec(dllexport) d() { printf("in d\n"); printf("environ=%x\n", environ); } m.c: #include #include 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