[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MirageOS-devel] Calling C libraries from mirage OS

On 4 December 2015 at 17:50, Robert Pickering
<robertfpickering@xxxxxxxxxxxx> wrote:
> I'm trying to call a C library from mirage OS.
> I'm following the example from git hub here:
> https://github.com/yallop/ocaml-ctypes-expat-example
> This example builds with an ocamlfind command-line, it doesn't use
> mirage and config.ml to generate a Makefile. I figured out I need use
> "add_to_ocamlfind_libraries" and "add_to_opam_packages" to insert the
> relevant flags into the make file, so the project builds without error
> when I run:
> mirage configure --unix
> make
> (I know add_to_ocamlfind_libraries / add_to_opam_packages are
> depreciated but all the examples are still using them)
> I also need to add the c library I'm calling to the command lines in the
> makefile. I've had a look thought "mirage.ml" can't see function to do
> that:
> https://github.com/mirage/mirage/blob/master/lib/mirage.ml
> What am I missing?

At least with the Xen target, it's not possible to link to C stubs
directly from the unikernel build. You have to build a library with
the C stubs, and then depend on that (because mirage reads the link
options from the ocamlfind META file).

Would make testing easier if there were a way to do it directly though.

Dr Thomas Leonard        http://roscidus.com/blog/
GPG: DA98 25AE CAD0 8975 7CDA  BD8E 0713 3F96 CA74 D8BA

MirageOS-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.