Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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: 2002-06-18 (12:02)
From: Yunming.WANG@e...
Subject: [Caml-list] interface C and OCaml

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

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

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.


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

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: