Discussion:
[Caml-list] ctypes and oasis
(too old to reply)
Christoph Höger
2016-09-07 08:58:23 UTC
Permalink
Dear all,

I attempt to compile an oasis project structured like this:

library Bar
Modules: Wrapper
CSources: bar.c
BuildDepends: ctypes.foreign
CCLib: -lfoo


Essentially, bar is both an extension of foo and a binding of this
extension for OCaml (using ctypes).

The "extension" point is problematic. While I can build this lib just
fine, the ctype bindings to the extension methods in bar.c are not found
at runtime using Dl:

Dl.DL_error("./main.native: undefined symbol: some_bar")

This is to be expected, as there is no dynamic library for bar.

So how do I solve this?

Is there some way to tell oasis to build a shared library from the
csources (and link it to all depending artifacts)?

thanks,

Christoph
--
Christoph Höger

Technische Universität Berlin
Fakultät IV - Elektrotechnik und Informatik
Übersetzerbau und Programmiersprachen

Sekr. TEL12-2, Ernst-Reuter-Platz 7, 10587 Berlin

Tel.: +49 (30) 314-24890
E-Mail: ***@tu-berlin.de
--
Caml-list mailing list. Subscription management and archives:
https://sympa.inria.fr/sympa/arc/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs
Jeremy Yallop
2016-09-07 11:12:47 UTC
Permalink
Dear Christoph,

On 7 September 2016 at 09:58, Christoph Höger
Post by Christoph Höger
library Bar
Modules: Wrapper
CSources: bar.c
BuildDepends: ctypes.foreign
CCLib: -lfoo
Essentially, bar is both an extension of foo and a binding of this
extension for OCaml (using ctypes).
The "extension" point is problematic. While I can build this lib just
fine, the ctype bindings to the extension methods in bar.c are not found
The easiest approach is to build a shared library libbar.so from bar.c
using the C toolchain and then to link that library in to the Bar
OCaml library using -lbar.

Kind regards,

Jeremy.
--
Caml-list mailing list. Subscription management and archives:
https://sympa.inria.fr/sympa/arc/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs
Loading...