Re: dynamic linking and C libraries

From: Xavier Leroy (
Date: Tue Feb 10 1998 - 21:23:52 MET

From: Xavier Leroy <>
Message-Id: <>
Subject: Re: dynamic linking and C libraries
In-Reply-To: <> from Scott Alexander at "Jan 26, 98 10:54:58 pm"
To: (Scott Alexander)
Date: Tue, 10 Feb 1998 21:23:52 +0100 (MET)

> I am having a problem when I try to dynamically link code which uses
> functions from C libraries (externals). I sometimes get a message like:
> The external function `is_digit_odd' is not available
> My workaround for this is to call the function in some statically linked
> part of the program. Is there a better fix for this problem?

Try using the "-linkall" option to ocamlc when linking your main
application (the one that does the dynamic linking).

The "-linkall" option disables the normal elimination of unused
modules and C primitives, and makes sure that all the modules and
libraries you mention on the command line are linked in and thus
available to dynamically-linked code. (The accompanying C primitives
are dragged in the executable along the way.)

Hope this helps.

- Xavier Leroy

This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:13 MET