Hi Adrien, I have changed to other computer and I could compile the msvc port of Ocaml. This time I didn't had any problem. I don't know what was wrong with my other computer. Now using ocamlopt (instead of flexlink) and the libasmrun.lib works fine. Thank you very much for your help. Leonardo On Fri, May 9, 2014 at 11:54 PM, Adrien Nader wrote: > On Fri, May 09, 2014, Leonardo Laguna wrote: > > This is what I'm executing: > > > > ocamlopt -output-obj -o ocamllibrary.o library.ml > > cl /c my_plugin.c /I"C:\\wodi32\\opt\\wodi32\\lib\\ocaml\\std-lib" > > cl /c ocaml_stub.c /I"C:\\wodi32\\opt\\wodi32\\lib\\ocaml\\std-lib" > > flexlink -chain msvc -exe -o my_plugin.exe my_plugin.obj ocaml_stub.obj > > ocamllibrary.o plug.lib -lasmrun -lgcc -L > > "C:\wodi32\lib\gcc\i686-w64-mingw32\4.8.2" > > My take on it (as you can see, it's really mine) would be something > like (with an ocaml toolchain based on the mingw port): > > ocamlopt -output-obj -o ocamllibrary.o library.ml > ocamlc -c my_plugin.c > ocamlc -c ocaml_stub.c > ocamlopt -o my_plugin.exe ocaml_stub.o my_plugin.o ocamllibrary.o plug.lib > > The ideas behind this are: > - gcc and msvc create compatible object files even though they have a > different extension > - static libraries are archives of objects and are also usable directly > - the ocaml compiler knows best how to call the C compiler for C files; > calling the C compiler by hand is an endless source of pain (if you > want more details, add -verbose to the ocaml* invocations) > - same for the linker > > -- > Adrien Nader >