Idea for C++ Interop

Craig Black cblack at ara.com
Sat Dec 23 07:11:44 PST 2006


That's the implication that I was trying to communicate when I said "C++ to
C" compiler.

-Craig

"Carlos Santander" <csantander619 at gmail.com> wrote in message
news:emjd06$170f$1 at digitaldaemon.com...
> Craig Black escribió:
> > I've been thinking about how to provide interoperability between D and
C++.
> > One idea I had was to compile C++ to C.  I've never used such a compiler
but
> > I'm fairly sure that they exist.
> >
> > Thoughts?
> >
> > -Craig
> >
> >
>
> I posted this on 2004-05-02, so I don't know if any changes have been made
since
> then:
>
> ---- OP ----
>
> g++ seems to do a different name mangling than dmc, so this only works on
> windows.
>
> [file: test1.cpp]
> #include <stdio.h>
> void foo() { printf("Hi from C++\n"); }
>
> [file: test2.d]
> extern (C++) void foo();
> void main() { foo(); }
>
>  > dmc -c test1.cpp
>  > dmd test2.d test1.obj
>
> ---- End OP ----
>
> So, if things remain the same, I guess you can compile your project with
DMC and
> have interoperability right away.
>
> --
> Carlos Santander Bernal





More information about the Digitalmars-d mailing list