Using dpp on the openmpi headers

rikki cattermole rikki at cattermole.co.nz
Fri Mar 13 08:13:44 UTC 2020


On 13/03/2020 9:08 PM, Peter Jacobs wrote:
> /**
>   * Convert D's string[] args to a correct C char** argv.
>   */
> char** toArgv(string[] args)
> {
>      auto argv = new char*[args.length + 1];
>      foreach(i, arg; args)
>      {
>          argv[i] = (arg.dup ~ '\0').ptr;
>      }
>      argv[args.length] = null;
>      return argv.ptr;
> }

https://dlang.org/phobos/core_runtime.html#.Runtime.cArgs


More information about the Digitalmars-d mailing list