I've gone through http://dlang.org/cpp_interface.html and in all of the examples, even those where some C++ code calls some D code, the main function resides in D (and so the binary being called is the one compiled from the D source file). The "calling D from C++" example in the doc has a function foo defined in D, which gets called from a function bar in C++, and bar in turn gets called from the main function in D.
Is it possible to just call D code from the C++ function? I'm trying to do something simple like the following, but keep getting build errors:
In D:
import std.stdio;
extern (C++) void CallFromCPlusPlusTest() {
writeln("You can call me from C++");
}
Then in C++:
#include <iostream>
using namespace std;
void CallFromCPlusPlusTest();
int main() {
cout << "hello world"<<"\n";
CallFromCPlusPlusTest();
}