[plt-scheme] FFI: Passing a char*** into C

From: Thomas Chust (chust at web.de)
Date: Fri Apr 23 17:50:41 EDT 2010

2010/4/23 Grant Rettke <grettke at acm.org>:
> [...]
> I'm calling into a function[1] that expects a char*** input. From
> reading the FFI docs it looks like char*** might map to a _list of
> strings... or perhaps a _pointer to a _list of strings?
> [...]
> [1] http://www.mcs.anl.gov/research/projects/mpi/www/www3/MPI_Init.html
> [...]

Hello Grant,

judging by the documentation you mentioned, the char*** is intended as
an input/output argument containing a list of strings. You should be
able to bind the function like this:

  (define mpi-init
     "MPI_Init" libmpi
     (_fun (args)
           [argc : (_ptr io _int) = (length args)]
           [argv : (_ptr io (_list io _string argc)) = args]
           [status : _int]
           (values status argv))))


When C++ is your hammer, every problem looks like your thumb.

Posted on the users mailing list.