www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/2000/07/11/14:02:27

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
Message-ID: <779F20BCCE5AD31186A50008C75D9979171745@silldn_mail1.sanwaint.com>
From: "Fifer, Eric" <EFifer AT sanwaint DOT com>
To: "'cygwin-developers AT sourceware DOT cygnus DOT com'"
<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)

>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

- Raw text -


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