Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] interface C and OCaml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Yunming.WANG@e...
Subject: [Caml-list] interface C and OCaml
Hi,

I'm a beginner.  Please help me to resove the problem.  Thank you.

D:\ocaml\oc\myself>echo %OS%
Windows_NT

D:\ocaml\oc\myself>type callc.ml
external plus : int -> int -> int -> int = "myPlus";;
print_int (plus 1 2 3) ;;
print_newline () ;;

D:\ocaml\oc\myself>type calledbycaml.c
#include <stdio.h>
#include <caml/mlvalues.h>
CAMLprim value myPlus (value x1,value x2,value x3)
{
        return Val_long ( Long_val(x1) + Long_val(x2) + Long_val(x3));
}

D:\ocaml\oc\myself>cl -c -I%OCAMLLIB% calledbycaml.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8168 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.

calledbycaml.c

D:\ocaml\oc\myself>ocamlc -o tyr.exe calledbycaml.obj callc.ml
Error while linking callc.cmo:
The external function `myPlus' is not available


-------------------
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