Why can't we use strings in C++ methods?

Emmanuel Danso Nyarko emmankoko519 at gmail.com
Sat Nov 4 14:47:48 UTC 2023


On Saturday, 4 November 2023 at 14:21:49 UTC, Paul Backus wrote:
> On Saturday, 4 November 2023 at 03:00:49 UTC, Dadoum wrote:
>> [...]
>
> `extern(C++)` functions use C++ name mangling, which includes 
> the types of the parameters in the mangled name. However, since 
> C++ does not have a built-in slice type like D's `T[]`, there 
> is no valid C++ mangling for a D slice. Because of this, it is 
> impossible to compile an `extern(C++)` function that has a D 
> slice as a parameter.
>
> [...]

Simply add perfectly explained!


More information about the Digitalmars-d-learn mailing list