C++ Binding / extern(C++)
Gregor Richards
Richards at codu.org
Wed Mar 28 12:54:34 PDT 2007
Dan wrote:
> I was just discussing how difficult it would be for someone to write C++ bindings to a project on the dsource forums, and remembered how I wanted to use Ogre with D and wished Sinbad was done... and how DirectFB is done in C++...
>
> Has anyone figured out how to bind D to C++ on any include/importable level? (source, AST, OBJ files, extern'ing to the *.h files)
>
> If they have, maybe we can set up a project to automatically bind C++ projects in, and Walter might add it to his linker?
>
> For example, matching scrambled names by scrambling a copy of the D ones, matching it, binding it?
>
> Or perhaps if Walter allowed extern(C++) by matching the identifiers in the AST's and passed the extern(C++) segment to the digital mars C++ compiler with the shared identifiers?
>
> Just my thoughts...
There already is a project to automatically bind C++ to D, it's just not
particularly complete or accurate.
http://www.dsource.org/projects/bcd/
The method is simple: Generate a C binding to the C++, then generate a D
binding to the C.
- Gregor Richards
PS: extern(C++) is a terrible idea. It wouldn't be cross-compatible.
More information about the Digitalmars-d
mailing list