* Re: [Caml-list] Linking native ocaml object files into C app on Windows
[not found] <20040610190443.A10900@pauillac.inria.fr>
@ 2004-06-10 17:28 ` peter.ilberg
0 siblings, 0 replies; 3+ messages in thread
From: peter.ilberg @ 2004-06-10 17:28 UTC (permalink / raw)
To: caml-list
That's it! Everything builds, links and runs fine! Thank you!
Peter
Xavier Leroy <xavier.leroy@inria.fr>
06/10/2004 12:04 PM
To: peter.ilberg@ni.com
cc:
Subject: Re: [Caml-list] Linking native ocaml object files
into C app on Windows
> I'm trying to add some ocaml code (a simple lexer/parser) to an existing
C
> application and I'm having problems linking the whole thing on Windows.
> Needless to say, everything works fine under Unix (Mac OS X). I'm using
> the MSVC version of ocaml.
>
> Here's are the commands that I use to build the whole thing:
>
> cl /c /nologo /MT /I "C:\Program Files\Objective Caml\lib" main.c
> ocamllex lexer.mll
> ocamlopt -c -output-obj lexer.ml -o lexer.obj
Three problems:
1) -c turns linking off, while you really want to do a
(partial) link here.
2) The compilation of lexer.ml already
produces lexer.obj, so you give lexer.obj both as input and as output
to the partial linker, which can break things.
3) With the MSVC port, the output of the partial linker is a .lib file,
not a .obj file, so it would be prudent to name the output
appropriately.
Try this instead:
ocamlopt -output-obj -o lexer.lib lexer.ml
Hope this helps,
- Xavier Leroy
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Caml-list] Linking native ocaml object files into C app on Windows
[not found] <40C87D7B.6010504@lexifi.com>
@ 2004-06-10 16:07 ` peter.ilberg
0 siblings, 0 replies; 3+ messages in thread
From: peter.ilberg @ 2004-06-10 16:07 UTC (permalink / raw)
To: caml-list
I've added stdlib.lib and I'm compiling the C file with ocamlopt now, but
things still aren't working. The link errors for the Lexing module are
gone, but they were replaced by many more from stdlib.lib.
Where are the functions _caml_curry2/3 or _caml_apply2/3/4 defined? They
aren't in libasmrun.lib, I verified that with dumpbin. I'm using Ocaml
3.06.
Peter
ocamlopt -cc cl -ccopt /nologo -ccopt /MT main.c
ocamllex lexer.mll
ocamlopt -cc cl -ccopt /nologo -ccopt /MT -c -output-obj lexer.ml -o
lexer.obj
link /nologo /out:test /libpath:"c:\progra~1\object~1\lib" main.obj
lexer.obj stdlib.lib libasmrun.lib
stdlib.lib(sys.obj) : error LNK2001: unresolved external symbol
_caml_curry2
stdlib.lib(char.obj) : error LNK2001: unresolved external symbol
_caml_curry2
stdlib.lib(list.obj) : error LNK2001: unresolved external symbol
_caml_curry2
lexer.obj : error LNK2001: unresolved external symbol _caml_curry2
stdlib.lib(lexing.obj) : error LNK2001: unresolved external symbol
_caml_curry2
stdlib.lib(pervasives.obj) : error LNK2001: unresolved external symbol
_caml_curry2
stdlib.lib(string.obj) : error LNK2001: unresolved external symbol
_caml_curry2
stdlib.lib(lexing.obj) : error LNK2001: unresolved external symbol
_caml_apply2
stdlib.lib(list.obj) : error LNK2001: unresolved external symbol
_caml_apply2
libasmrun.lib(i386nt.obj) : error LNK2001: unresolved external symbol
_caml_apply2
stdlib.lib(lexing.obj) : error LNK2001: unresolved external symbol
_caml_curry3
stdlib.lib(pervasives.obj) : error LNK2001: unresolved external symbol
_caml_curry3
stdlib.lib(string.obj) : error LNK2001: unresolved external symbol
_caml_curry3
stdlib.lib(list.obj) : error LNK2001: unresolved external symbol
_caml_curry3
stdlib.lib(pervasives.obj) : error LNK2001: unresolved external symbol
_End_of_file
libasmrun.lib(fail.obj) : error LNK2001: unresolved external symbol
_End_of_file
stdlib.lib(pervasives.obj) : error LNK2001: unresolved external symbol
_Failure
libasmrun.lib(fail.obj) : error LNK2001: unresolved external symbol
_Failure
stdlib.lib(pervasives.obj) : error LNK2001: unresolved external symbol
_Invalid_argument
libasmrun.lib(fail.obj) : error LNK2001: unresolved external symbol
_Invalid_argument
stdlib.lib(pervasives.obj) : error LNK2001: unresolved external symbol
_caml_curry4
stdlib.lib(string.obj) : error LNK2001: unresolved external symbol
_caml_curry4
stdlib.lib(list.obj) : error LNK2001: unresolved external symbol
_caml_curry4
stdlib.lib(string.obj) : error LNK2001: unresolved external symbol
_Not_found
stdlib.lib(list.obj) : error LNK2001: unresolved external symbol
_Not_found
libasmrun.lib(fail.obj) : error LNK2001: unresolved external symbol
_Not_found
stdlib.lib(string.obj) : error LNK2001: unresolved external symbol
_caml_curry5
stdlib.lib(list.obj) : error LNK2001: unresolved external symbol
_Assert_failure
stdlib.lib(list.obj) : error LNK2001: unresolved external symbol
_caml_apply3
libasmrun.lib(i386nt.obj) : error LNK2001: unresolved external symbol
_caml_apply3
libasmrun.lib(startup.obj) : error LNK2001: unresolved external symbol
_caml_code_segments
libasmrun.lib(startup.obj) : error LNK2001: unresolved external symbol
_caml_data_segments
libasmrun.lib(fail.obj) : error LNK2001: unresolved external symbol
_Out_of_memory
libasmrun.lib(fail.obj) : error LNK2001: unresolved external symbol
_Stack_overflow
libasmrun.lib(fail.obj) : error LNK2001: unresolved external symbol
_Sys_error
libasmrun.lib(fail.obj) : error LNK2001: unresolved external symbol
_Division_by_zero
libasmrun.lib(fail.obj) : error LNK2001: unresolved external symbol
_Sys_blocked_io
libasmrun.lib(i386nt.obj) : error LNK2001: unresolved external symbol
_caml_program
libasmrun.lib(roots.obj) : error LNK2001: unresolved external symbol
_caml_globals
libasmrun.lib(roots.obj) : error LNK2001: unresolved external symbol
_caml_frametable
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Caml-list] Linking native ocaml object files into C app on Windows
@ 2004-06-10 14:07 peter.ilberg
0 siblings, 0 replies; 3+ messages in thread
From: peter.ilberg @ 2004-06-10 14:07 UTC (permalink / raw)
To: caml-list
Hello everyone!
I'm trying to add some ocaml code (a simple lexer/parser) to an existing C
application and I'm having problems linking the whole thing on Windows.
Needless to say, everything works fine under Unix (Mac OS X). I'm using
the MSVC version of ocaml.
Here's are the commands that I use to build the whole thing:
cl /c /nologo /MT /I "C:\Program Files\Objective Caml\lib" main.c
ocamllex lexer.mll
ocamlopt -c -output-obj lexer.ml -o lexer.obj
cl -o test main.obj lexer.obj /link /nologo
/libpath:"c:\progra~1\object~1\lib" libasmrun.lib
And here are the link errors that result from the last command:
lexer.obj : error LNK2001: unresolved external symbol _Lexing__engine_117
lexer.obj : error LNK2001: unresolved external symbol
_Lexing__from_function_140
lexer.obj : error LNK2001: unresolved external symbol _Lexing__lexeme_155
lexer.obj : error LNK2001: unresolved external symbol
_Pervasives__close_out_232
lexer.obj : error LNK2001: unresolved external symbol
_Pervasives__open_out_202
lexer.obj : error LNK2001: unresolved external symbol
_Pervasives__output_string_214
lexer.obj : error LNK2001: unresolved external symbol _caml_curry2
libasmrun.lib(startup.obj) : error LNK2001: unresolved external symbol
_caml_code_segments
libasmrun.lib(startup.obj) : error LNK2001: unresolved external symbol
_caml_data_segments
libasmrun.lib(fail.obj) : error LNK2001: unresolved external symbol
_Failure
libasmrun.lib(fail.obj) : error LNK2001: unresolved external symbol
_Invalid_argument
libasmrun.lib(fail.obj) : error LNK2001: unresolved external symbol
_Out_of_memory
libasmrun.lib(fail.obj) : error LNK2001: unresolved external symbol
_Stack_overflow
libasmrun.lib(fail.obj) : error LNK2001: unresolved external symbol
_Sys_error
libasmrun.lib(fail.obj) : error LNK2001: unresolved external symbol
_End_of_file
libasmrun.lib(fail.obj) : error LNK2001: unresolved external symbol
_Division_by_zero
libasmrun.lib(fail.obj) : error LNK2001: unresolved external symbol
_Not_found
libasmrun.lib(fail.obj) : error LNK2001: unresolved external symbol
_Sys_blocked_io
libasmrun.lib(i386nt.obj) : error LNK2001: unresolved external symbol
_caml_apply2
libasmrun.lib(i386nt.obj) : error LNK2001: unresolved external symbol
_caml_apply3
libasmrun.lib(i386nt.obj) : error LNK2001: unresolved external symbol
_caml_program
libasmrun.lib(roots.obj) : error LNK2001: unresolved external symbol
_caml_globals
libasmrun.lib(roots.obj) : error LNK2001: unresolved external symbol
_caml_frametable
test.exe : fatal error LNK1120: 23 unresolved externals
I'm sure I'm missing something obvious, but I can't figure it out. Thanks
in advance,
Peter
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2004-06-10 17:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20040610190443.A10900@pauillac.inria.fr>
2004-06-10 17:28 ` [Caml-list] Linking native ocaml object files into C app on Windows peter.ilberg
[not found] <40C87D7B.6010504@lexifi.com>
2004-06-10 16:07 ` peter.ilberg
2004-06-10 14:07 peter.ilberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox