caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: wester@ilt.fhg.de
To: caml-list@inria.fr
Subject: C-Interface problem
Date: Mon, 12 Feb 2001 09:42:32 +0100	[thread overview]
Message-ID: <200102120842.JAA23441@ilt.fhg.de> (raw)

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



                 reply	other threads:[~2001-02-12 13:04 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=200102120842.JAA23441@ilt.fhg.de \
    --to=wester@ilt.fhg.de \
    --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).