Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
* [Caml-list] Including a C library statically in an Ocaml library
@ 2016-01-08 14:14 Malcolm Matalka
  2016-01-08 14:58 ` Christopher Zimmermann
  2016-01-08 15:15 ` David Sheets
  0 siblings, 2 replies; 6+ messages in thread
From: Malcolm Matalka @ 2016-01-08 14:14 UTC (permalink / raw)
  To: caml-list

The core problem I am having is a C library I want to bind has a number
of macros which I need the value of.  Here is how I am trying to solve
it, but perhaps there is a better way:

I have a small C library which gets compiled to libfoo.a which provides
functions that return the macro values, like:

int macro1() { return MACRO1; }

I then have an ocaml library, called ofoo, that uses Ctypes to bind to macro1:

let macro1 = foreign "macro" (void @-> returning int)

Where I am having issues is this small library, I'd prefer it to not
have to be installed on the system but just compiled into the Ocaml
library so that a user just has to link against that library.  Right
now, none of the symbols (macro1) are being included in the library, I'm
guessing because the linker sees no direct use of them.  And I'm not
even sure if I can get it included in the ocaml library.  I'm also not
able to get the libfoo symbols linked into a final executable, I'm
guessing for similar reasons.

What are my options here?

If I've missed any useful information, let me know.  I haven't interoped
much with C directory in Ocaml so I'm not sure what information is
important.

/Malcolm

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

end of thread, other threads:[~2016-01-08 15:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-08 14:14 [Caml-list] Including a C library statically in an Ocaml library Malcolm Matalka
2016-01-08 14:58 ` Christopher Zimmermann
2016-01-08 15:08   ` Malcolm Matalka
2016-01-08 15:15 ` David Sheets
2016-01-08 15:19   ` Malcolm Matalka
2016-01-08 15:24     ` David Sheets

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox