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: Wolfgang Lux <lux@p...>
Subject: Re: Missing something in getting C and Ocaml to Work Together
Steve Stevenson wrote

> 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?

You use the standard bytecode interpreter, which does not know anything 
about your C function, to start your custom executable. Just use

 ./a.out

to start the program. Actually, you (nearly) never have to call ocamlrun 
yourself, the bytecode program contains some nice magic to start up the 
right bytecode interpreter for you.

Regards
Wolfgang

--
Wolfgang Lux				  Phone: +49-251-83-38263
Institut fuer Wirtschaftinformatik	    FAX: +49-251-83-38259
Universitaet Muenster		      Email: wlux@uni-muenster.de