From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id CAA09335; Sun, 27 Jan 2002 02:35:29 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id CAA08736 for ; Sun, 27 Jan 2002 02:35:28 +0100 (MET) Received: from mail.cs.net.pl (cyber.cs.net.pl [62.233.142.98]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g0R1ZQf26308 for ; Sun, 27 Jan 2002 02:35:27 +0100 (MET) Received: by mail.cs.net.pl (Postfix, from userid 510) id C2453840; Sun, 27 Jan 2002 02:35:19 +0100 (CET) Date: Sun, 27 Jan 2002 02:35:19 +0100 From: Tomasz Zielonka To: CAML list Subject: [Caml-list] Problem with using oo in dynamically loaded bytecode ocaml runtime Message-ID: <20020127013519.GA20780@cs.net.pl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.25i Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hi Situation: 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 libcamlrun. I linked bytecode files into .o with following command: ocamlc -g -custom -output-obj -o plocamlb_bytecode.o plocamlb_spi.cmo \ plocamlb_mlfuns.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 luck. When I make native/opt library _and_ define a method, I get corrupted memory in the postgresql backend. So: 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 tom -- .-. Tomasz Zielonka CYBER SERVICE oo| programista http://www.cs.net.pl /`'\ zielony@cs.net.pl (\_;/) tel: [48] (22) 723-06-79 | tel/fax: [48] (22) 723-01-75 ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr