Version française
Home     About     Download     Resources     Contact us    
Browse thread
dynamic linking and C libraries
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Xavier Leroy <Xavier.Leroy@i...>
Subject: Re: dynamic linking and C libraries
> 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