DEV Community 👩‍💻👨‍💻

Discussion on: D and C++: Passing dynamic strings

markboer profile image
Mark Boer

Hey @fxcqz , really good to see some C++ on :-)

I have read about the D langauge and should really give it a try. I was wondering though, is this the only way to pass strings from C++ to D. The function you wrote is mostly the C style of doing things, in C++ i would expect a signature like:

std::string numbers_upto(int n)

Do you really need the intermediate char* for it to work?

eljayadobe profile image

C is the common ABI ... the lingua franca between C++ and D. (And the lingua franca between many otherwise incompatible compiled programmings languages.)

If you want to give D a try, you can use dmd (Digital Mars), gdc (GNU GCC family), or ldc2 (LLVM family) compilers. q.v. D compilers