Passing string from D to c++

Jesse Phillips jessek.phillips+D at gmail.com
Tue Jul 30 23:07:04 PDT 2013


On Wednesday, 31 July 2013 at 05:44:38 UTC, deadalnix wrote:
> On Tuesday, 30 July 2013 at 20:57:55 UTC, Jesse Phillips wrote:
>> On Tuesday, 30 July 2013 at 20:09:01 UTC, Milvakili wrote:
>>
>>> So I need to pass them as char*, I can not pass them as 
>>> string?
>>
>> C++ doesn't have an immutable(char)[], it has char* and its 
>> own string class. To communicate with it one must choose a 
>> type both languages can understand, char* is that. D may be 
>> able to get away with providing a C++ string, but I'm not 
>> familiar with the integration layer.
>
> const char*, char const* are equivalent to const(char)* in D.

I was referring to string types:
http://www.cplusplus.com/reference/string/string/

If his C++ functions takes a const char* he should be passing it
a const/immutable(char)* as you say, not an immutable(char)[]


More information about the Digitalmars-d mailing list