How to pass null function pointers in OCaml ctypes bindings for OCI

There are bindings


type oci_env

let oci_env : oci_env Ctypes.structure Ctypes.typ = Ctypes.structure "OCIEnv"

let malloc_func =
  Ctypes.(Foreign.funptr @@ ptr void @-> size_t @-> returning void)

let ralloc_func =
  Ctypes.(Foreign.funptr @@ ptr void @-> ptr void @-> size_t @-> returning void)

let mfree_func =
  Ctypes.(Foreign.funptr @@ ptr void @-> ptr void @-> returning void)

let oci_env_create =
  Foreign.foreign "OCIEnvCreate"
  @@ Ctypes.(
       ptr (ptr oci_env)
       @-> uint32_t @-> ptr void @-> malloc_func @-> ralloc_func @-> mfree_func
       @-> size_t
       @-> ptr (ptr void)
       @-> returning int32_t)

to this function

sword OCIEnvCreate ( OCIEnv **envhpp, 
                                     ub4 mode, 
                                     const void *ctxp, 
                                     const void *(*malocfp)
                                                        (void *ctxp,
                                                         size_t size),
                                    const void *(*ralocfp)
                                                      (void *ctxp,
                                                       void *memptr,
                                                       size_t newsize),
                                    const void (*mfreefp)
                                                     (void *ctxp,
                                                      void *memptr))
                                                      size_t xtramemsz,
                                                      void **usrmempp );

i’m not strong in C, but the function, as I understand it, allows calling itself without implementing the allocation and deallocation functions

OCIEnv *envhp;
...
/* Create a thread-safe OCI environment with N' substitution turned on. */
if(OCIEnvCreate((OCIEnv **)&envhp,
            (ub4)OCI_THREADED | OCI_NCHAR_LITERAL_REPLACE_ON,
            (void *)0, (void * (*)(void *, size_t))0,
            (void * (*)(void *, void *, size_t))0,
            (void (*)(void *, void *))0,
            (size_t)0, (void **)0))

how to call the OCaml version without implementing the functions?

None - but your need something like ptr_opt void in the signature.

Yes, funptr_opt.