On Friday, 18 March 2016 at 13:45:18 UTC, Jonas Drewsen wrote:
For a hack week at work I am thinking about creating a module in D that can be used with our existing application which is written in C++.

Can anyone shed some light on the current status of interfacing with C++? In particular:

1, Can I build my C++ program using visual c++ and then link a D module compiled with gdc/ldc/dmd into it using the ms linker?

This is what we do for LDC.
Perhaps the only annoyance is that you have to know what linker flags gdc/ldc/dmd use. See https://github.com/ldc-developers/ldc/blob/master/CMakeLists.txt#L126-L177 It'd be nice to be able to call `dmd -ldflags` whose output would be the standard linker flags.

3, Which features of D or C++ should I expect not to work or shouldn't use when interfacing.

C++ constructors/destructors are different from their D siblings.
To help with this, you can define creation/destruction helper functions that you would call from the other domain, for example C++ calling a "Class* createClass(...)" function, defined in D as something like
extern(C++) Class createClass(...) {
   return new Class(...);
}

Reply via email to