caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Alexander V.Voinov" <avv@quasar.ipa.nw.ru>
To: caml-list@inria.fr
Subject: [Caml-list] embedding OCaml into C on win32
Date: Tue, 02 Jul 2002 11:56:19 -0700 (PDT)	[thread overview]
Message-ID: <20020702.115619.74735853.avv@quasar.ipa.nw.ru> (raw)

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


             reply	other threads:[~2002-07-02 18:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-02 18:56 Alexander V.Voinov [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020702.115619.74735853.avv@quasar.ipa.nw.ru \
    --to=avv@quasar.ipa.nw.ru \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).