I’m trying to interface glfw with Cstubs.
The glfwSetErrorCallback function takes a pointer to a function callback as parameter and returns the previous function callback pointer. If the function is called with NULL this remove the currently set callback.
GLFWerrorfun glfwSetErrorCallback (GLFWerrorfun callback)
I implemented in type_description.ml
open Ctypes
module Types (F : Ctypes.TYPE) = struct
open F(* Constants *)
…(* Types *)
let errorfun = static_funptr (int @-> string @-> returning void)
end
and in Function_description.ml
module Types = Types_generated
module Functions (F : Ctypes.FOREIGN) = struct
open F
open Types
let glfwSetErrorCallback = foreign “glfwSetErrorCallback” (errorfun @-> returning errorfun)end
How can I call the glfwSetErrorCallback function with a null pointer?
There is prt_opt but there isn’t static_funptr_opt.
I tried to use coerce but I don’t know how to convert null to errorfun.