<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE message PUBLIC
  "-//MLarc//DTD MLarc output files//EN"
  "../../mlarc.dtd"[
  <!ATTLIST message
    listname CDATA #REQUIRED
    title CDATA #REQUIRED
  >
]>

  <?xml-stylesheet href="../../mlarc.xsl" type="text/xsl"?>


<message 
  url="2006/02/6ed6f081242c3173121ca4ea026de69f"
  from="Florent Monnier &lt;fmonnier@l...&gt;"
  author="Florent Monnier"
  date="2006-02-03T15:04:52"
  subject="Caml with main in C  + .cmxa"
  prev="2006/02/2641e29d70e30f3e6dee4ac20e939b0c"
  next="2006/02/76caa78dff1e9412838a7f6e36883e86"
  next-in-thread="2006/02/cc10da4a97264e6ce2e2036802b6fb15"
  prev-thread="2006/02/2641e29d70e30f3e6dee4ac20e939b0c"
  next-thread="2006/02/76caa78dff1e9412838a7f6e36883e86"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="Caml with main in C  + .cmxa">
<msg 
  url="2006/02/6ed6f081242c3173121ca4ea026de69f"
  from="Florent Monnier &lt;fmonnier@l...&gt;"
  author="Florent Monnier"
  date="2006-02-03T15:04:52"
  subject="Caml with main in C  + .cmxa">
<msg 
  url="2006/02/cc10da4a97264e6ce2e2036802b6fb15"
  from="Florent Monnier &lt;fmonnier@l...&gt;"
  author="Florent Monnier"
  date="2006-02-03T18:35:22"
  subject="Re: [Caml-list] Caml with main in C  + .cmxa">
</msg>
</msg>
</thread>

<contents>
Hi,

I'm compiling the beginning of a small app written in OCaml but with the main 
which boot the app in C.
The OCaml app should also use a .cmxa lib, which is a binding to a C lib.

Without the .cmxa binding, compiling works good with this:

% ocamlopt -c  app.ml
% ocamlopt -output-obj -o mlobj.o  unix.cmxa  app.cmx
% gcc main.c  -o myapp.opt  mlobj.o \
        -I'/usr/local/lib/ocaml' \
        -L/usr/local/lib/ocaml \
        -lunix -lasmrun  -lm -ldl


But now I'm trying to figure out how to compile with the .cmxa
which is the binding to ImageMagick  (hump ~contrib:487)

To compile C code without caml pieces with the libMagick is done this way:
gcc `Magick-config --cflags --cppflags` app.c `Magick-config --ldflags --libs`

So here is my attempt to mix all together:

% ocamlopt -c  -I +libMagick  magick.cmxa   app.ml
% ocamlopt -output-obj -o mlobj.o unix.cmxa -I +libMagick magick.cmxa  app.cmx
(untill there, no error messages)

% gcc `Magick-config --cflags --cppflags`  main.c  -o myapp.opt  mlobj.o \
        -I'/usr/local/lib/ocaml' \
        -L/usr/local/lib/ocaml \
        -lunix -lasmrun  -lm -ldl \
        `Magick-config --ldflags --libs`

and then with this last command, I get about 200 errors like this:
--------------------
mlobj.o: In function `camlMagick__scale_1177':
: undefined reference to `fun_scaleimage'

mlobj.o: In function `camlMagick__sharpen_1136':
: undefined reference to `fun_sharpenimage'

mlobj.o: In function `camlMagick__blur_channel_1193':
: undefined reference to `fun_blurimagechannel'
--------------------

'fun_scaleimage' and the others are the names of the functions in
the C file of the OCaml-libMagick binding.



So what is the error I have done?
What should I correct to get the app compliled?


-- 
Thanks in advance
Florent Monnier

</contents>

</message>

