caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* User-defined printers and external C code
       [not found] <20100328100004.6833DBC57@yquem.inria.fr>
@ 2010-03-28 10:24 ` Stefan Ratschan
  2010-03-28 20:05   ` [Caml-list] " Dmitry Bely
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Ratschan @ 2010-03-28 10:24 UTC (permalink / raw)
  To: caml-list

> 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

Any ideas?

Stefan Ratschan





^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Caml-list] User-defined printers and external C code
  2010-03-28 10:24 ` User-defined printers and external C code Stefan Ratschan
@ 2010-03-28 20:05   ` Dmitry Bely
  0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Bely @ 2010-03-28 20:05 UTC (permalink / raw)
  To: Caml List

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-03-28 20:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20100328100004.6833DBC57@yquem.inria.fr>
2010-03-28 10:24 ` User-defined printers and external C code Stefan Ratschan
2010-03-28 20:05   ` [Caml-list] " Dmitry Bely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).