delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/2000/07/05/07:53:21

Mailing-List: contact cygwin-developers-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-developers-subscribe AT sourceware DOT cygnus DOT com>
List-Archive: <http://sourceware.cygnus.com/ml/cygwin-developers/>
List-Post: <mailto:cygwin-developers AT sourceware DOT cygnus DOT com>
List-Help: <mailto:cygwin-developers-help AT sourceware DOT cygnus DOT com>, <http://sourceware.cygnus.com/ml/#faqs>
Sender: cygwin-developers-owner AT sourceware DOT cygnus DOT com
Delivered-To: mailing list cygwin-developers AT sourceware DOT cygnus DOT com
Message-ID: <779F20BCCE5AD31186A50008C75D9979171740@silldn_mail1.sanwaint.com>
From: "Fifer, Eric" <EFifer AT sanwaint DOT com>
To: cygwin-developers AT sourceware DOT cygnus DOT com
Subject: _impure_ptr uninitialized in DLLs?
Date: Wed, 5 Jul 2000 12:50:29 +0100
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2650.21)

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



- Raw text -


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