Passing string from D to c++

Milvakili maliy.kayit at gmail.com
Tue Jul 30 13:22:45 PDT 2013


On Tuesday, 30 July 2013 at 20:17:34 UTC, John Colvin wrote:
> On Tuesday, 30 July 2013 at 20:09:01 UTC, Milvakili wrote:
>> On Tuesday, 30 July 2013 at 20:02:51 UTC, Dicebot wrote:
>>> On Tuesday, 30 July 2013 at 19:52:44 UTC, Milvakili wrote:
>>>> I'm linking D with C++ lib.a file.  When the C++ function 
>>>> has compatible data types I can call them from D.  But when 
>>>> I changed the parameter to string I got bunch of errors.
>>>>
>>>> Data Type Compatibility table does not include strings.  Is 
>>>> there a way of passing strings?
>>>
>>> http://dlang.org/phobos/std_string.html#.toStringz
>>
>>
>> So I need to pass them as char*, I can not pass them as string?
>
> Correct.
>
> Just thinking off the top of my head: you could probably hack 
> something together though with a struct and casting.

Thanks.  Is there any work in progress related to string passing?
I think string passing should be solved automatically.

Coz otherwise one need to write wrapper for each c++ function 
that has a string parameter.

thanks.


More information about the Digitalmars-d mailing list