On Wed, Jan 25, 2012 at 6:35 AM, Rainer Schuetze <[email protected]> wrote: > I was thinking about making something similar some time ago to integrate > compiler functionality in D programs: instead of trying to translate dmd, > just replace the memory allocations with the D-GC and otherwise link > directly to the C++ code. >
That's getting quite close to possible. So far static member functions, free functions and normal member functions link and run correctly. I've got virtual member functions and ctors/dtors linking as well, but making them work is today's task. My initial goal is to port the lexer to d, then hopefully package it for phobos. Being able to link c++ code makes it possible to run the complete test suite on it without having to port the rest of dmd. > I figured out some issues and made two tiny changes. Maybe your changes > cover these, but in case they might help: > >[snip] I did something similar to get the struct symbol, but not as clean. To mangle/link the members correctly, dmd needs more modifications as final functions that don't override anything always have a vtable slot. And destructors don't for some reason. > > I also noticed that calling a virtual function of a derived extern(C++) > interface uses a wrong offset into the virtual function table, but did not > try to fix it yet. > > Rainer > Yeah, this bug has been on my radar for a while. Hopefully it shouldn't be to hard to fix, com classes should be using the correct mechanism somewhere in there. _______________________________________________ dmd-internals mailing list [email protected] http://lists.puremagic.com/mailman/listinfo/dmd-internals
