Version française
Home     About     Download     Resources     Contact us    
Browse thread
Missing something in getting C and Ocaml to Work Together
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Steve Stevenson <steve@c...>
Subject: Missing something in getting C and Ocaml to Work Together
Good Afternoon,

	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.


external cmainarg : int -> string array -> unit = "cmainarg"
external io_infile_stdin : unit -> unit = "io_infile_stdin"
external cmaininit : unit -> unit = "cmaininit"


let main() =
  cmainarg  (Array.length Sys.argv)  Sys.argv;
  io_infile_stdin ();
  cmaininit();
  0
(*end*)

And I use this to compile

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'

What am I doing wrong?

Thanks. (NO, I don't know who will be president yet. :-)

steve