* ocamlc linking with .dll
@ 2009-03-20 12:34 Matthieu Dubuget
2009-03-20 12:55 ` Matthieu Dubuget
0 siblings, 1 reply; 2+ messages in thread
From: Matthieu Dubuget @ 2009-03-20 12:34 UTC (permalink / raw)
To: caml-list
According to the manual,
for ocamlc:
> Arguments ending in .so (.dll under Windows) are assumed to be C
> shared libraries (DLLs).
> During linking, they are searched for external C functions referenced
> from the Caml code,
> and their names are written in the generated bytecode executable. The
> run-time system
> ocamlrun then loads them dynamically at program start-up time.
If I try:
> $ ocamlc -custom -o m.exe ms_gates.native.dll m_stub.c m.ml
> ** Cannot resolve symbols for m_stub.o:
> _ms_gates_init
> _ms_gates_version
> File "m.ml", line 1, characters 0-1:
> Error: Error while building custom runtime system
The dll is not passed to flexlink, as we can check with "-verbose":
> $ ocamlc -custom -o m.exe -verbose ms_gates.native.dll
> m_stub.c m.ml
> + gcc -mno-cygwin -O -mms-bitfields -Wall -Wno-unused -c
> -I"C:/cygwin/home/matt/ocamlmgw/lib" "m_stub.c"
> + flexlink -chain mingw -exe -o "m.exe"
> "-LC:/cygwin/home/matt/ocamlmgw/lib"
> "c:\DOCUME~1\matt\LOCALS~1\Temp\camlprimec3406.c" "m_stub.o"
> "-lcamlrun" -lws2_32
> ** Cannot resolve symbols for m_stub.o:
> _ms_gates_init
> _ms_gates_version
> File "m.ml", line 1, characters 0-1:
> Error: Error while building custom runtime system
This is solved by adding -cclib in front of the dll name:
> $ ocamlc -custom -o m.exe -verbose -cclib ms_gates.native.dll
> m_stub.c m.ml
> + gcc -mno-cygwin -O -mms-bitfields -Wall -Wno-unused -c
> -I"C:/cygwin/home/matt/ocamlmgw/lib" "m_stub.c"
>
> + flexlink -chain mingw -exe -o "m.exe"
> "-LC:/cygwin/home/matt/ocamlmgw/lib"
> "c:\DOCUME~1\matt\LOCALS~1\Temp\camlprimc0b326.c"
> "ms_gates.native.dll" "m_stub.o" "-lcamlrun" -lws2_32
>
Is there a bug, either in the documentation or in ocamlc?
Salutations
Matt
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-03-20 12:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-20 12:34 ocamlc linking with .dll Matthieu Dubuget
2009-03-20 12:55 ` Matthieu Dubuget
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox