Would this be useful?
https://github.com/1100110/OpenMPI
On Sunday, 12 August 2012 at 20:52:03 UTC, Simen Kjaeraas wrote:
On Sun, 12 Aug 2012 22:30:57 +0200, Andrew
<andrew.sp...@gmail.com> wrote:
I'm attempting to create a wrapper for MPI, however, MPI_Init
wants to read the arguments for main():
MPI_Init(int *argv, char ***argc);
How do I get this last level of pointer reference?
So far, I have:
void main (string[] args)
{
auto argarr = new char*[args.length];
foreach(i, a; args)
argarr[i] = (a.dup ~ '\0').ptr;
int argc = to!(int)(argarr.length);
MPI_Init(&argc, argarr.ptr);
}
Any ideas?
// Array of pointers to command line parameters.
char*[] argv = args.map!((a)=>(a.dup~'\0').ptr).array;
// Address of first element of that array.
char** argvp = &argv[0];
// And finally, address of the pointer to that first
element.
char*** argvpp = &argvp;
Now, the interesting part is reconstructing the string[] from
the potentially modified argvpp...