yallop / ocaml-ctypes

Library for binding to C libraries using pure OCaml
MIT License
363 stars 95 forks source link

Can't compile ocaml-ctypes (missing Dl implementation) #612

Closed TyOverby closed 4 years ago

TyOverby commented 4 years ago

I ran the following:

opam install ctypes-foreign

my dune file looks like this:

(library
   (name name_goes_here)
   (libraries base core_kernel ctypes async)
   (inline_tests)
   (preprocess
    (pps ppx_jane)))

And the error message that I get is the following:

No implementations provided for the following modules:
    Dl referenced from name_goes_here.cmxa

I'm building on ubuntu, so I don't understand why it didn't pull in dl.ml.unix

hcarty commented 4 years ago

I think you need to add ctypes.foreign or ctypes.foreign.threaded to your libraries list. ctypes only links the core ctypes library without any of the dlopen or libffi support pieces.

TyOverby commented 4 years ago

ctypes.foreign did the trick; thanks!

For other people trying to do the same, how should I submit documentation for this?

yallop commented 4 years ago

One possibility is a new entry in the FAQ.

yallop commented 4 years ago

Closing, because there's nothing to fix here. (But please feel free to submit documentation improvements.)