On Friday, 25 January 2013 at 20:45:22 UTC, Szymon wrote:
1) Is D2 really ready for production code?

I use it and very rarely hit compiler bugs. Really depends what combination of features you use: I tend to stick to more conservative parts of the language, and have very few problems. Other people can't write ten lines without something going wrong though.

Is it true that D has GC problems?

It is slow. If speed is a worry, you'll want to keep away. If not, it gets the job done well enough.

2) Is there a way to start adding D code to a C++ projects?

Yes. You'll need to expose parts of the D code as extern(C) or extern(C++) to interface with it, and remember to initialize the D runtime.

This is something I did for a different thing (on Linux too, haven't tried on Windows) and it isn't really documented, but if you grab this zip:

http://arsdnet.net/dcode/dtocpp.zip

And check out testcpp.d and test.cpp, you can see some interaction. Notice that the main() function is in C++, and they are statically linked together. Functions, data, and even some classes (notice the extern(C++) interface in testcpp.d, which is inherited froma D class: Cat, and a C++ class, Dog) can interact between the two languages.

Indeed, in that zip is also a program called dtoh, which reads a json file generated by dmd, and outputs a C++ interface for it. The Makefile shows the commands, albeit assuming Linux.



Statically linking C++ and D on Windows 32 bit is a pain in the ass. You probably want to avoid that entirely. But doing a DLL isn't as bad... I've used C++ dlls from D exes before, but not the other way around. Still though, it should be doable and not terribly much different than the static example.

3) Is it possible to use D on iOS?

Not at this time.

Reply via email to