Why can't we use strings in C++ methods?
Dadoum
dadoum at protonmail.com
Sat Nov 4 12:34:28 UTC 2023
On Saturday, 4 November 2023 at 12:01:11 UTC, Emmanuel Danso
Nyarko wrote:
> [...]
>
> So C-strings are just an array of characters that are governed
> by simple functions and D strings also defined the same. So you
> could see that D strings are possibly built on the architecture
> of C strings. In C++, string is a complex standard template
> library that generates complex symbols and cannot be mapped as
> it is based on a standard library implementation.
I don't think the strings are being translated in any way when we
change the linkage. Strings in D are dynamic arrays of chars, the
C binding code is giving us a template representing D's dynamic
arrays, and so I thought that we could also use it in C++ for
interoperability with D dynamic arrays.
More information about the Digitalmars-d-learn
mailing list