Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Problem with using oo in dynamically loaded bytecode ocaml runtime
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-01-27 (01:35)
From: Tomasz Zielonka <zielony@c...>
Subject: [Caml-list] Problem with using oo in dynamically loaded bytecode ocaml runtime


I'm doing some integration of OCaml and PostgreSQL. PostgreSQL loads a
DSO which implements so called "procedural language call handler". 

I've built this DSO by ld-shared'ing libcamlrun.a with some additional C
.o files, .o with wrappers for callback'ed ocaml funs, .o with new
primitives and .o with ocaml bytecode. I also removed main.o from

I linked bytecode files into .o with following command:

  ocamlc -g -custom -output-obj -o plocamlb_bytecode.o plocamlb_spi.cmo \

Problem: Everything worked fine until I wanted to define a class.

When I define a class with _no methods_, it works, but there is little
use of such class.

When I define any method in this class (but still don't use a single
instance of the class) it stops working. After loading the DSO, ocaml
raises Not_found exception and quits.

I wanted to use CAMLRUNPARAM b (stack backtrace) option, but apparently
it doesn't work with such a library/DSO (Program not linked with -g,
cannot print stack backtrace).

I couldn't force ocamlc to keep DBUG section. I'm not sure it would
help, because read_debug_info tries to open executable file, not the
loaded DSO. I tried several caml_main_param[0] (different files), no

When I make native/opt library _and_ define a method, I get corrupted
memory in the postgresql backend.

1) There is a bug, but where? In my program, in OCaml?
2) How to get stack backtrace in this situation?

thank you in advance

   .-.   Tomasz Zielonka                           CYBER SERVICE
   oo|   programista              
 (\_;/)  tel: [48] (22) 723-06-79 | tel/fax: [48] (22) 723-01-75
Bug reports:  FAQ:
To unsubscribe, mail  Archives: