[squeak-dev] FFI (Plugin) | Question about multi-dimensional arrays (e.g., char**, int**, void*****...)

Marcel Taeumel marcel.taeumel at hpi.de
Mon Jun 15 12:52:32 UTC 2020


> Hello, C99:

So, "char (*libs[n])" would be equivalent to "char *libs[n]", which is an array of n pointers, each pointing to a character ... which is a null-terminated string, I suppose? Like "char **argv" or "char *argv[]" ... but with n

Best,
Marcel
Am 15.06.2020 14:34:02 schrieb Tobias Pape <das.linux at gmx.de>:

> On 15.06.2020, at 14:24, Jakob Reschke wrote:
>
>
> Marcel Taeumel schrieb am Mo., 15. Juni 2020, 13:22:
>
> - Accept type names such as "int **" or "int[][]" in FFI-call specs and struct-field spec
>
> One further note: int[][] is not valid C in parameter types. Only the first [] can be without length, and is equivalent to a pointer. So char*argv[] is the same as char**argv. Valid parameter type examples: int a[][3], int b[][2][3]. These are like int(*a)[3] and int(*b)[2][3] if I am not mistaken.
>

Hello, C99:

/* Find all paths that may contain dynamic libraries.
* Returns their count. libs may be NULL to get allocation size
*/
static size_t _sqo_lib_paths(size_t const n, char (*libs[n]))
{
/*...*/
}

;)

-t

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200615/d3838952/attachment.html>


More information about the Squeak-dev mailing list