Browse thread
C-Interface problem
- wester@i...
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | wester@i... |
| Subject: | C-Interface problem |
Hi,
I want to write a small extension to OCaml (my first try).
I have the following files:
primitives.mli:
external ilt_spawn : string -> string -> int = "ilt_spawn"
primitives.ml:
open Primitives
let sp = ilt_spawn
I type:
ocamlc -c primitives.mli
and get primitives.cmi.
When I then try to compile primitives.ml with
ocamlc -c primitives.ml
I get the error message:
The implementation primitives.ml does not match the interface
primitives.cmi: The field 'ilt_spawn' is required but not provided.
What did I do wrong?
My primitives.c file reads:
#include <caml/mlvalues.h>
#include <process.h>
extern "C"
{
int ilt_spawn_(const char * cmd, const char * argument)
{
int ret = _spawnl(_P_NOWAIT, cmd, cmd, argument, NULL);
return ret;
}
value ilt_spawn(value cmd, value argument)
{
int ret = ilt_spawn_((const char * ) String_val(cmd), (const char *
)String_val(argument)); return Val_long(ret);
}
}
I compile this file with VC++6.0. I would like to build a toplevel with:
ocamlmktop -custom -o mytop primitives.obj primitives.cma
Would this be correct?
I would be very appreciative for help on this problem.
With kind regards.
Rolf Wester
-------------------------------------
Rolf Wester
wester@ilt.fhg.de