caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] ctypes and oasis
@ 2016-09-07  8:58 Christoph Höger
  2016-09-07 11:12 ` Jeremy Yallop
  0 siblings, 1 reply; 2+ messages in thread
From: Christoph Höger @ 2016-09-07  8:58 UTC (permalink / raw)
  To: caml users

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: christoph.hoeger@tu-berlin.de

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Caml-list] ctypes and oasis
  2016-09-07  8:58 [Caml-list] ctypes and oasis Christoph Höger
@ 2016-09-07 11:12 ` Jeremy Yallop
  0 siblings, 0 replies; 2+ messages in thread
From: Jeremy Yallop @ 2016-09-07 11:12 UTC (permalink / raw)
  To: Christoph Höger; +Cc: caml users

Dear Christoph,

On 7 September 2016 at 09:58, Christoph Höger
<christoph.hoeger@tu-berlin.de> wrote:
> 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:

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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-09-07 11:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-07  8:58 [Caml-list] ctypes and oasis Christoph Höger
2016-09-07 11:12 ` Jeremy Yallop

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).