English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

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: 2000-11-23 (12:22)
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


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.


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