ocaml-ctypes
ocaml-ctypes copied to clipboard
Cannot #require "ctypes.foreign";; in utop (or rlwrap ocaml) on Windows
Hi! I'm a total newbie to OCaml, but I'm very interested in a possibility of learning it for use in a REPL on Windows, for rapid prototyping with WinAPI. I managed to install OCaml, OPAM, ctypes+ctypes.foreign, and utop per the awesome guide by Jonathan Protzenko, and to get utop to work (I've merged some additional fixes that I discovered in the process into the guide).
Unfortunately, when I try to #require "ctypes.foreign";; in utop, I'm getting the following error:
Error: Reference to undefined global `Ctypes_closure_properties'
Note: full transcript of the session is here - it contains output of a utop session in cmd.exe terminal, and also of an additional rlwrap ocaml session in Cygwin terminal.
I've managed to google up some comment, which seems to mention that "a static version of libffi" might work, as hinted in #198; but I'm a total newbie to OCaml, and unfortunately I have no faintest idea how I could apply this suggestion to utop... :(
Could you hopefully help me to try and get ctypes.foreign to work in utop on Windows?
The instructions here, specifically the bit about adding the following to .bashrc
export PATH="/usr/x86_64-w64-mingw32/sys-root/mingw/bin:$PATH"
makes foreign work.
Facing this issue on Linux. When I try to do #require "ctypes.foreign";; It gives me this error that Error: Reference to undefined global `Ctypes_closure_properties'.
@kevallakhani95: how did you install ctypes? using opam?
@yallop Yes.
@kevallakhani95: Could you give a bit more information about your system? Which version of Linux are you running? It'd also be handy to have the output of each of the following commands:
pkg-config --modversion libffi
ocamlfind query ctypes.foreign
ocamlfind query ctypes
opam config env
opam list | grep ctypes
@yallop just got it working. Thanks! :)