dlopen() bug

skaller skaller@users.sourceforge.net
Wed Mar 22 07:54:00 GMT 2006


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/



More information about the Cygwin mailing list