On 04/26/2012 12:08 PM, Xavier ALLAMIGEON wrote:
What do you mean exactly? I imagine that test.o needs some functions of
the libhello_world.a. But I don't see why libasmrun would need some
other functions of libhello_world...

Well, this is the case. libasmrun contains the runtime system for OCaml code (compiled with ocamlopt) and, as you can see in the error message from the linker, it depends on symbols provided by the OCaml program. For instance, the garbage collector (in libasmrum) needs to find special symbols, to locate some data structures (in libhello_world.a) created by the compiler.

What about the following alternative where libasmrun is directly
appended to the .a file?
cp "`ocamlc -where`"/libasmrun.a libhello_world.a
ar rcs libhello_world.a ml_code.obj.o c_code.o
gcc -o test -L. -L"`ocamlc -where`" test.c -lhello_world -lm -ldl

This looks fine to me.

-- Alain

--
Caml-list mailing list.  Subscription management and archives:
https://sympa-roc.inria.fr/wws/info/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Reply via email to