Accessing C++ code from D

James Dunne james.jdunne at gmail.com
Thu May 18 19:32:51 PDT 2006


Ben Cooley wrote:
>[snip]
> 
> And Yes, interop issues are part of the reason why the new .NET system is
> gaining ground against Java.  Both microsoft C# and Cpp have interop with
> eachother.  C# has unsafe code, which is completely compatible with C and Cpp,
> and Cpp has complete interop with the .NET world, including C#.
> 

C#'s unsafe code is not native or unmanaged code - it is managed code 
that allows the use of pointers into the GC heap.  C# only interops with 
C code through runtime marshalling.  It does not interop with native C++ 
code - such code has to be recompiled through Microsoft's "Managed 
Extensions for C++" compiler, after much tinkering albeit.

I'll bet that if you were to take the time to convert your existing C++ 
library over to .NET you'd find you'd spend the same amount of time as 
you would creating a C API wrapper around such code for D to use.

-- 
Regards,
James Dunne



More information about the Digitalmars-d mailing list