Source

opycaml / from_python_c.c

#include "api_ml.h"

extern PyMethodDef OPyCamlMethods[];

char *argv0 = "from python"; // Ugly hack for ocaml to distinguish whether the main is Python or OCaml

PyMODINIT_FUNC initopycaml(void)
{
    fprintf(stderr, "OPyCaml initopycaml\n");
    
    char *argv[2];
    argv[0] = argv0;
    argv[1] = NULL;

    caml_startup(argv);
}