ocaml-ctypes icon indicating copy to clipboard operation
ocaml-ctypes copied to clipboard

Cannot #require "ctypes.foreign";; in utop (or rlwrap ocaml) on Windows

Open akavel opened this issue 9 years ago • 6 comments

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?

akavel avatar Sep 01 '16 20:09 akavel

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.

andrewray avatar Nov 11 '16 03:11 andrewray

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 avatar Jun 14 '17 20:06 kevallakhani95

@kevallakhani95: how did you install ctypes? using opam?

yallop avatar Jun 14 '17 21:06 yallop

@yallop Yes.

kevallakhani95 avatar Jun 14 '17 21:06 kevallakhani95

@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 avatar Jun 14 '17 21:06 yallop

@yallop just got it working. Thanks! :)

kevallakhani95 avatar Jun 14 '17 21:06 kevallakhani95