On Fri, 2009-06-19 at 17:02 +0200, Danny Backx wrote:
> I'm trying to track down the problem by writing small test programs that
> use C++ constructors in the presence of DLLs.
> 
> I have something with a constructor in a DLL that doesn't look right,
> but I've not figured it out yet.

There's nothing wrong with sharing, or with sharing your own mistakes,
is there ?

Here's one.

Type "make" and things will compile nicely. Run the "usedemo" and you'll
see 

\network\x86> usedemo
X()
~X()
\network\x86> 

which appears to indicate that the application crashes somewhere after
the constructor in the DLL. Try everything to find the problem,
including reading the assembler source, messing with the constructor
pointers (yes you can have them called e.g. twice).

Rewrite the usedemo.c to load the DLL dynamically. Find that loading the
DLL works but fetching the function doesn't.

\network\x86> dynload
In main
X()
GetProcAddress(doit) -> error 87
~X()
\network\x86>

Those who can read the sources with sufficient attention have figured
out that the function didn't exist under that name due to C++ name
mangling.

Replace demodll.C by the other version, recompile, and you'll see that
it all does work :
\network\x86> usedemo
X()
In main
Y()
Message from DLL (0)
~Y()
After DLL call
~X()
\network\x86> 

Windows CE never told me what happened to the application, it just
silently killed it.

gdbserver also doesn't appear to trap this (meaning : Windows CE doesn't
pass debugging events in this occasion). The gdbserver gets
ERROR_PIPE_NOT_CONNECTED and can only assess that the application has
died.

        Danny
-- 
Danny Backx ; danny.backx - at - scarlet.be ; http://danny.backx.info

Attachment: demodll.tar.gz
Description: application/compressed-tar

------------------------------------------------------------------------------
Are you an open source citizen? Join us for the Open Source Bridge conference!
Portland, OR, June 17-19. Two days of sessions, one day of unconference: $250.
Need another reason to go? 24-hour hacker lounge. Register today!
http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org
_______________________________________________
Cegcc-devel mailing list
Cegcc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cegcc-devel

Reply via email to