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
Building with OCamlMkLib
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2009-01-22 (15:21)
From: John Whitington <john@c...>
Subject: Re: Building with OCamlMkLib

On 20 Jan 2009, at 17:03, John Whitington wrote:
> I'm building a Plain C interface to our PDF libraries, but am stuck.  
> The idea is to build a library with Ocamlmklib containing the C  
> wrapper around the ocaml code.

Thanks to those who helped me here - I finally settled on a modified  
version of what's given in 18.8 in the manual.

Here are the new files:


And here's what we ended up with...

ocamlc cpdflibc.mli
ocamlopt cpdflibc.ml
ocamlc cpdflibwrapper.c
ocamlopt -output-obj -o cpdflibc.o cpdflibc.cmx
cp /usr/local/lib/ocaml/libasmrun.a cpdflib.a
ar r cpdflib.a cpdflibc.o cpdflibwrapper.o

...producing the final cpdflib.a with which we can do...

cc -o test test.c cpdflib.a

...to use the library.

With Thanks,

John Whitington
Coherent Graphics Ltd