Calling C++ code with pointer** argument

abad via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jun 1 00:29:56 PDT 2016


On Wednesday, 1 June 2016 at 07:17:04 UTC, Mike Parker wrote:
> On Wednesday, 1 June 2016 at 07:09:16 UTC, abad wrote:
>
> Try this:
>
> extern(C++) void DoesNotLink(const(char)**);

That does work, though I have to explicitly cast it in my caller 
as well.
Like this:

doesNotLink(cast(const(char)**)baz2);

It's a bit troublesome as my code will include quite a lot of 
calls like this.

Casting is not necessary with the method call with the single 
pointer argument, as it seems to get const'ed automatically.

> And I don't know if this was just a typo in your post,  but 
> also note that you 'D'oesNotLink in the CPP source you pasted 
> and 'd'oesNotLink in the D code.

That was just a typo.



More information about the Digitalmars-d-learn mailing list