caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] embedding OCaml into C on win32
@ 2002-07-02 18:56 Alexander V.Voinov
  2002-07-02 20:48 ` [Caml-list] camlp4 and anonymous function naming Julie Farago
  2002-07-02 21:30 ` [Caml-list] embedding OCaml into C on win32 Alexander V.Voinov
  0 siblings, 2 replies; 5+ messages in thread
From: Alexander V.Voinov @ 2002-07-02 18:56 UTC (permalink / raw)
  To: caml-list

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 <stdio.h>
#include <caml/mlvalues.h>
#include <caml/alloc.h>
#include <caml/memory.h>
#include <caml/callback.h>
#include <caml/custom.h>

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2002-07-03  8:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-02 18:56 [Caml-list] embedding OCaml into C on win32 Alexander V.Voinov
2002-07-02 20:48 ` [Caml-list] camlp4 and anonymous function naming Julie Farago
2002-07-03  8:08   ` Daniel de Rauglaudre
2002-07-02 21:30 ` [Caml-list] embedding OCaml into C on win32 Alexander V.Voinov
2002-07-02 22:32   ` Alexander V.Voinov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).