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
User-defined printers and external C code
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2010-03-28 (20:05)
From: Dmitry Bely <dmitry.bely@g...>
Subject: Re: [Caml-list] User-defined printers and external C code
On Sun, Mar 28, 2010 at 2:24 PM, Stefan Ratschan
<stefan.ratschan@cs.cas.cz> wrote:
>> The printing of Big_int is possible and AFAIK Big_int is an abstract
>> data type.
>> let print_big_int (value_big_int:Big_int.big_int) =
>>    Format.printf "%s" (Big_int.string_of_big_int value_big_int);;
> I see, thanks. If I interpret this correctly, then the same code is
> loaded twice. Once in the program to be debugged, once for the printer.
> Now I have the following problem: The ADT I want to print uses an
> external C library. Ocamldebug refuses to load it, saying:
> (ocd) load_printer ../smath/libsmath.a
> Error during code loading: ../smath/libsmath.a is not a bytecode object
> file

How is this C library linked into your Ocaml program? Probably the
custom runtime?

> Any ideas?

Dynamic loading should help you (see ocamlmklib chapter in the
manual). Then the C code will be placed into .so file and loaded
automatically then needed.

- Dmitry Bely