caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* C-Interface problem
@ 2001-02-12  8:42 wester
  0 siblings, 0 replies; only message in thread
From: wester @ 2001-02-12  8:42 UTC (permalink / raw)
  To: caml-list

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



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-02-12 13:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-02-12  8:42 C-Interface problem wester

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