caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Bruno Deferrari <utizoc@gmail.com>
To: dbenjamin@janestreet.com
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Static linking via Ctypes?
Date: Tue, 25 Mar 2014 12:04:01 -0300	[thread overview]
Message-ID: <CACnPB4rWZdOfTr6vrEZapz1GrM_Tqde8jJwt9MXR8LoicK-UUw@mail.gmail.com> (raw)
In-Reply-To: <sympa.1395758971.27651.464@inria.fr>

On Tue, Mar 25, 2014 at 11:54 AM,  <dbenjamin@janestreet.com> wrote:
> I'm using Ctypes to interface with a dynamic library, but in addition to the
> interface provided the library I have some helper functions (written in C,
> against the same library) that I'd also like to call via Ctypes.  Is there any
> way to achieve this via static linking or am I required to build another
> shared object?
>

Static linking works. I was in this same situation yesterday, and
adding the .o files that were generated from C sources to the linking
step did the trick.

If you are trying to link a .a file, you may have to pass the
-force_load option to the linker to force it to include it, otherwise
it may see that none of the symbols there are being referenced
directly and decide to not include it (this happened to me when using
clang in OSX).

> --
> 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



-- 
BD

  reply	other threads:[~2014-03-25 15:04 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-25 14:54 dbenjamin
2014-03-25 15:04 ` Bruno Deferrari [this message]
2014-03-25 15:11   ` Dan Benjamin
2014-03-25 15:24     ` David Sheets
2014-03-25 17:55       ` Dan Benjamin
2014-03-25 21:19         ` Jeremy Yallop
2014-03-25 21:37           ` Milan Stanojević
2014-03-25 23:14             ` Jeremy Yallop
2014-03-26 16:24               ` Travis Brady
2014-03-26 17:17                 ` Daniel Bünzli
2014-03-26 17:25               ` Milan Stanojević
2014-03-25 15:10 ` Daniel Bünzli

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=CACnPB4rWZdOfTr6vrEZapz1GrM_Tqde8jJwt9MXR8LoicK-UUw@mail.gmail.com \
    --to=utizoc@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=dbenjamin@janestreet.com \
    /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;
as well as URLs for NNTP newsgroup(s).