When I am reading the chapter about FFI,I get two questions.
- When importing ctypes-foreign module , Which sentence should I use?
require "ctypes-foreign" ;;
or
require "ctypes.foreign" ;;
? The later is work fine for me.
2. When I execute
let initscr =
foreign "initscr" (void @-> returning window);;
I get an Exception ,
Exception: Dl.DL_error(“dlsym(RTLD_DEFAULT, initscr): symbol not found”).
Raised at Dl._report_dl_error in file “src/ctypes-foreign-base/dl.ml”, line 42, characters 20-44
Called from Ctypes_foreign_basis.Make.foreign in file “src/ctypes-foreign-base/ctypes_foreign_basis.ml”, line 47, characters 19-47
Re-raised at Ctypes_foreign_basis.Make.foreign in file “src/ctypes-foreign-base/ctypes_foreign_basis.ml”, line 49, characters 50-59
Called from unknown location
Called from Toploop.load_lambda in file “toplevel/toploop.ml”, line 212, characters 17-27
I have no idea about this .