On Monday, 9 July 2018 at 10:56:18 UTC, Andre Pany wrote:
On Monday, 9 July 2018 at 10:38:54 UTC, Basile B. wrote:
On Monday, 9 July 2018 at 10:33:03 UTC, Andre Pany wrote:
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.
Thanks, it seems I also have to allocate the pointer before
with the numbers of numParams.
In python the code looks s.th. like this
self.output_names = (c_char_p * self.number_outputs)()
Do you know that is the equivalent in D?
Kind regards
André
you don't need to allocate but to retrieve each string, do
something like this:
foreach(i; 0 .. numParams)
{
string p = fromStringz(paramNames + i)
}
although i have a doubt for pointer arithmetic. Maybe it should
be incremented by
i * size_t.sizeof
since char.sizeof is 1. Maybe someone else will be more helpful
here.
Baz.