This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: dlopen() bug


On Tue, 2006-03-21 at 19:52 +0100, Bernhard Loos wrote:
> Hello
> 
> Is there any progress in solving the problem mentioned in this thread:
> http://cygwin.com/ml/cygwin/2006-03/msg00274.html ?

The example in that page is bugged and there is no
reason at all to expect it to work.

The mainline ct.c is a C program, it's compiled
as a C program, and so cannot interact with C++
libraries.

The mainline of any body of code using C++ MUST be
compiled as C++. Furthermore you must NOT explicitly
link libstdc++, that is the job of the compiler.

The fact that the example works when libstdc++ is linked
with the mainline simply suggests an implementation artefact
that some startup code is stored in the library and the linker
manages to execute it.

There's no assurance this is actually initialising everything
correctly. Some initialisation may need to be done 'on the
bottom of the stack' and/or before other code, and it is too 
late when a dll is called half way through the program.

-- 
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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]