From: Malcolm Matalka <mmatalka@gmail.com>
To: caml-list@inria.fr
Subject: [Caml-list] Including a C library statically in an Ocaml library
Date: Fri, 08 Jan 2016 14:14:22 +0000 [thread overview]
Message-ID: <86r3hsnoox.fsf@gmail.com> (raw)
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
next reply other threads:[~2016-01-08 14:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-08 14:14 Malcolm Matalka [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86r3hsnoox.fsf@gmail.com \
--to=mmatalka@gmail.com \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox