Idea for C++ Interop
Carlos Santander
csantander619 at gmail.com
Sat Dec 23 05:58:16 PST 2006
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