DLL: (const char *paramNames[],size_t numParams)

Basile B. b2.temp at gmx.com
Mon Jul 9 10:38:54 UTC 2018


On Monday, 9 July 2018 at 10:33:03 UTC, Andre Pany wrote:
> Hi,
>
> I need to call a C function within a DLL which has following 
> signature:
>   void GetParamNames (const char *paramNames[], size_t 
> numParams);
>
> The purpose of this function is to return a list of texts
> I defined in D:
> extern(C) GetParamNames (const char[]* paramNames, size_t 
> numParams);
>
> Is this correct? How can I call the function? I tried several 
> possibilities but
> always get a runtime crash.
>
> Kind regards
> André

Hi, no it's not correct i think, right translation would be

     extern(C) void GetParamNames(const char** paramNames, size_t 
numParams);

If you use the D array syntax you'll get into troubles because of 
ABI i think.

Baz.


More information about the Digitalmars-d-learn mailing list