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

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



On 5 December 2015 at 10:07, Nick Betteridge <buzzheavyyear@xxxxxxxxxxx> wrote:
>
>>
>> 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).
>>
>
> Is there an example of this somewhere?

The io-page library is fairly simple:

https://github.com/mirage/io-page/blob/master/_oasis

It builds io_page_unix and io_page_xen libraries. The C flags are
added to the main META file with:

XMETAExtraLines: xen_linkopts = "-lio_page_xen_stubs"

There's a command to get the Xen flags:

PostConfCommand: ocaml postconf.ml

The Xen source file (stub_alloc_pages_xen.c) is just a symlink to the
Unix one (you need a separate file because OASIS can't compile the
same source path with different flags).


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

_______________________________________________
MirageOS-devel mailing list
MirageOS-devel@xxxxxxxxxxxxxxxxxxxx
http://lists.xenproject.org/cgi-bin/mailman/listinfo/mirageos-devel


 


Rackspace

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