From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id UAA27821; Tue, 2 Jul 2002 20:59:08 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id UAA27668 for ; Tue, 2 Jul 2002 20:59:08 +0200 (MET DST) Received: from str12.sobor.org (adsl-63-198-183-99.dsl.snfc21.pacbell.net [63.198.183.99]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g62Ix6b16581 for ; Tue, 2 Jul 2002 20:59:06 +0200 (MET DST) Received: from localhost (localhost.localdomain [127.0.0.1]) by str12.sobor.org (Postfix) with ESMTP id ACA3999860 for ; Tue, 2 Jul 2002 11:56:19 -0700 (PDT) Date: Tue, 02 Jul 2002 11:56:19 -0700 (PDT) Message-Id: <20020702.115619.74735853.avv@quasar.ipa.nw.ru> To: caml-list@inria.fr Subject: [Caml-list] embedding OCaml into C on win32 From: "Alexander V.Voinov" X-Mailer: Mew version 2.2 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hi I have a small program, similar to one in the manual (where fib_closure is defined). I try it on win32, with VC 6 and ocaml-3.04. The Makefile and the source texts are as follows. What else should I add to the link command to resolve these externals? Thank you Alexander =======Makefile:======================================================== PROG=test2 %.obj: %.ml ocamlopt -output-obj -c -o $@ $< %.obj: %.cpp cl /c /nologo /MT /Ic:/ocaml/lib $< %.obj: %.c cl /c /nologo /MT /Ic:/ocaml/lib $< run: $(PROG).exe ./$(PROG).exe $(PROG).exe: $(PROG).obj mltest.obj link /nologo $^ /OUT:$@ /libpath:"c:/ocaml/lib" libasmrun.lib =======test2.c:========================================================= #include #include #include #include #include #include int ml_inc(int n) { static value * ml_inc_closure = NULL; if (ml_inc_closure == NULL) ml_inc_closure = caml_named_value("ml_inc"); return Int_val(callback(*ml_inc_closure, Val_int(n))); } int main() { char *argv[] = { NULL }; int n; printf("In main\n"); fflush(stdout); caml_startup(argv); n = ml_inc(10); printf("n = %d\n", n); fflush(stdout); return 0; } ======mltest.ml========================================================= let ml_inc i = i + 1 let _ = Callback.register "ml_inc" ml_inc ======output:=========================================================== gmake -k cl /c /nologo /MT /Ic:/ocaml/lib test2.c test2.c ocamlopt -output-obj -c -o mltest.obj mltest.ml link /nologo test2.obj mltest.obj /OUT:test2.exe /libpath:"c:/ocaml/lib" libasmrun.lib 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_frametable libasmrun.lib(roots.obj) : error LNK2001: unresolved external symbol _caml_globals test2.exe : fatal error LNK1120: 16 unresolved externals ------------------- 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