I can build a static OCaml library without any problems but when I
try to package that and some other C code in a dynamic library I get
errors like this on Mac OSX:
/usr/bin/ld: ./libfib.a(fibcaml.o) has local relocation entries in
non-writable section (__TEXT,__text)
Thanks, Joel
_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs
Also you have to initialize the ocaml runtime from whiting you
library.., and for my best knowledge it is necessary to pass the path
to you .so to the caml_main function, like:
#define LIB_DIR "/home/pablo/ocaml/tproject/deploy/TuscanyCalculator"
static char *argv[] = {
LIB_DIR "/libTuscanyCalculatorImpl.so",
LIB_DIR "/libTuscanyCalculatorImpl.so",
NULL
};
caml_main (argv);
The way that work for my is to compile the c code with -c -fPIC flags,
compile the ocaml modules also with -c , and then link all the object
codes together with ocamlc -linkall -custom -cclib "-fPIC -shared
.. and include the libraries you need ( -lcamlrun_shared -ltermcap
in my system)
I think the best is to look at the makefile of the ocaml module for
the aol server http://www.crystalballinc.com/vlad/software/
or the apache mod_ocaml
http://merjis.com/developers/mod_caml , a lite more complex makefile.
also, look at these previous post in this area:
http://caml.inria.fr/pub/ml-archives/caml-list/2002/09/0d8daa135bd30302f1ebf30daf9a0ed9.en.html
http://caml.inria.fr/pub/ml-archives/caml-list/2002/01/44d30c5454106646098bf00977c66796.en.html
http://caml.inria.fr/pub/ml-archives/caml-list/2001/12/e9e89dadd773729481bf8446f1b73b64.en.html
and also the manual pages
http://caml.inria.fr/pub/docs/manual-ocaml/manual032.html
regards,
pablo.
2007/3/29, Joel Reymont <joe...@gmail.com>:
--
Pablo Polvorin
Sorry for late reply - I seem to have missed this the first time
around. There is an open bug on this issue:
http://caml.inria.fr/mantis/view.php?id=3866
Rich.
--
Richard Jones
Red Hat