From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id NAA17227 for caml-red; Thu, 23 Nov 2000 13:23:16 +0100 (MET) Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id VAA06976 for ; Wed, 22 Nov 2000 21:29:20 +0100 (MET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id eAMKTIP21231; Wed, 22 Nov 2000 21:29:18 +0100 (MET) Received: (from xleroy@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id VAA03486; Wed, 22 Nov 2000 21:29:17 +0100 (MET) Date: Wed, 22 Nov 2000 21:29:17 +0100 From: Xavier Leroy To: Steve Stevenson Cc: caml-list@inria.fr Subject: Re: Missing something in getting C and Ocaml to Work Together Message-ID: <20001122212917.A17173@pauillac.inria.fr> References: <14873.37069.529974.959686@merlin.cs.clemson.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: <14873.37069.529974.959686@merlin.cs.clemson.edu>; from steve@cs.clemson.edu on Mon, Nov 20, 2000 at 04:05:20PM -0500 Sender: weis@pauillac.inria.fr > I have a very simple application. I have the main in ocaml and > the rest of the system in C. I'm just trying something very straight > forward. > [...] > ocamlc main.cmo -custom -cclib csrc/libmainc.a > When I do, I get no errors but > ocamlrun a.out > produces > Fatal error: this bytecode file cannot run on this bytecode interpreter > Mismatch on primitive `cmainarg' Just run a.out directly, as in "./a.out". The -custom flag to ocamlc causes it to produce a "mixed" executable containing both OCaml bytecode and a specially tailored bytecode interpreter that includes your C code. Using the standard "ocamlrun" bytecode interpreter on such an executable fails, because ocamlrun doesn't contain the C functions that the bytecode part of the mixed executable calls ("cmainarg" here). Hope this helps, - Xavier Leroy