delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/03/22/00:46:13

X-Spam-Check-By: sourceware.org
Subject: Re: dlopen() bug
From: skaller <skaller AT users DOT sourceforge DOT net>
To: Bernhard Loos <bernloos AT web DOT de>
Cc: cygwin AT cygwin DOT com
In-Reply-To: <455506406@web.de>
References: <455506406 AT web DOT de>
Date: Wed, 22 Mar 2006 16:45:48 +1100
Message-Id: <1143006348.9731.127.camel@rosella.wigram>
Mime-Version: 1.0
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

On Wed, 2006-03-22 at 03:35 +0100, Bernhard Loos wrote:

> If the C++library declares its calls as 'extern "C"' (as it is done in the example),
> AFAIK there shouldn't be any problem.

Doesn't matter what you think you know -- it's not a permitted thing
to do, you never know what implementors are going to change.
 
> Anyway all this things aren't really related to the crash.

> I removed as much things as possible from the testcase and corrected
> the things mentioned above. 

Good. So now you've eliminated some possible causes of the
problem. Now it looks weird. A do nothing program is calling
dlopen() and dying for no reason.

> But I wasn't able to find a solution or even an explaination.
> 
> This is a part of the log from depency walker:
> 00:00:00.438: LoadLibraryA("H:\cygwin\test\CrashTest\CrashTest.dll") called from "CYGWIN1.DLL" at address 0x6100FCB2 by thread 1.
> 00:00:00.500: Loaded "CRASHTEST.DLL" at address 0x00B40000 by thread 1.  Successfully hooked module.
> 00:00:00.500: DllMain(0x00B40000, DLL_PROCESS_ATTACH, 0x00000000) in "CRASHTEST.DLL" called by thread 1.
> 00:00:00.500: First chance exception 0xC0000005 (Access Violation) occurred in "CYGWIN1.DLL" at address 0x610AE938 by thread 1.
> 00:00:00.500: Unloaded "CRASHTEST.DLL" at address 0x00B40000 by thread 1.
> 00:00:00.516: LoadLibraryA("H:\cygwin\test\CrashTest\CrashTest.dll") returned NULL by thread 1. Error: Unzulssiger Zugriff auf einen Speicherbereich (998).
> 00:00:00.578: First chance exception 0xC0000005 (Access Violation) occurred at address 0x00B4F37E by thread 1.
> 00:00:00.578: First chance exception 0xC0000005 (Access Violation) occurred in "CYGWIN1.DLL" at address 0x6108DFFC by thread 1.
> 00:00:00.578: First chance exception 0xC0000005 (Access Violation) occurred in "CYGWIN1.DLL" at address 0x6108DFFC by thread 1.
> 00:00:00.578: First chance exception 0xC0000005 (Access Violation) occurred in "CYGWIN1.DLL" at address 0x6108DFFC by thread 1.

Ouch. Hmm. But the code isn't doing anything!
This does look weird -- my system is doing what you're doing 
all the time. It was crashing badly for ages until someone pointed
out there was a bug in libstdc++ handling string crossing 
DLL boundaries. Since I fixed that the code works fine.

Perhaps you can try to build it, get Release Candidate 6
from:

http://felix.sf.net/


You'll need to install Ocaml and Python before it will work.
It does 100 or so triangle linkages like

	MAIN --loadtime-- > RTL
	\                   ^
	  \                /
	 dlopen        loadtime
            \            /
              V         /
              USER LIB

all C++ calling C++, works on two different Cygwins,
one running on XP32 and the other on XP64.


-- 
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


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