delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/2000/07/12/00:20:20

Mailing-List: contact cygwin-developers-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-developers-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin-developers/>
List-Post: <mailto:cygwin-developers AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-developers-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-developers-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin-developers AT sources DOT redhat DOT com
From: Chris Faylor <cgf AT cygnus DOT com>
Date: Wed, 12 Jul 2000 00:05:02 -0400
To: "'cygwin-developers AT sourceware DOT cygnus DOT com'" <cygwin-developers AT sourceware DOT cygnus DOT com>
Subject: Re: _impure_ptr uninitialized in DLLs?
Message-ID: <20000712000502.A685@cygnus.com>
Reply-To: cygwin-developers AT sourceware DOT cygnus DOT com
Mail-Followup-To: "'cygwin-developers AT sourceware DOT cygnus DOT com'" <cygwin-developers AT sourceware DOT cygnus DOT com>
References: <779F20BCCE5AD31186A50008C75D9979171745 AT silldn_mail1 DOT sanwaint DOT com>
Mime-Version: 1.0
User-Agent: Mutt/1.2i
In-Reply-To: <779F20BCCE5AD31186A50008C75D9979171745@silldn_mail1.sanwaint.com>; from EFifer@sanwaint.com on Tue, Jul 11, 2000 at 06:41:47PM +0100

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 AT cygnus DOT com                        Cygnus Solutions, a Red Hat company
http://sourceware.cygnus.com/         http://www.redhat.com/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019