From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by sympa.inria.fr (Postfix) with ESMTPS id D5FC07ED5C for ; Tue, 31 Jul 2012 16:03:30 +0200 (CEST) Received-SPF: None (mail4-smtp-sop.national.inria.fr: no sender authenticity information available from domain of georg.martius@web.de) identity=pra; client-ip=194.95.184.44; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="georg.martius@web.de"; x-sender="georg.martius@web.de"; x-conformance=sidf_compatible Received-SPF: None (mail4-smtp-sop.national.inria.fr: no sender authenticity information available from domain of georg.martius@web.de) identity=mailfrom; client-ip=194.95.184.44; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="georg.martius@web.de"; x-sender="georg.martius@web.de"; x-conformance=sidf_compatible Received-SPF: None (mail4-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mailhost.mis.mpg.de) identity=helo; client-ip=194.95.184.44; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="georg.martius@web.de"; x-sender="postmaster@mailhost.mis.mpg.de"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArsGABflF1DCX7gs/2dsb2JhbABFiCSxUYEHgiABAQU6PxALGAkVEA8BR4gWAROyMR+KBotJg22DHAOWW455gmE X-IronPort-AV: E=Sophos;i="4.77,686,1336341600"; d="scan'208";a="152121343" Received: from mailhost.mis.mpg.de ([194.95.184.44]) by mail4-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 31 Jul 2012 16:03:30 +0200 Received: from twww.mis.mpg.de (twww.mis.mpg.de [194.95.185.34]) by mailhost.mis.mpg.de (8.13.8/8.13.8) with ESMTP id q6VE3Qil003846; Tue, 31 Jul 2012 16:03:26 +0200 (MEST) Received: from arges.localnet (pcserv1n3.mis.mpg.de [141.5.26.73]) (authenticated bits=0) by twww.mis.mpg.de (8.14.4/8.14.4) with ESMTP id q6VE3SqT018520 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 31 Jul 2012 16:03:28 +0200 (MEST) From: Georg Martius To: caml-list@inria.fr Cc: Gerd Stolpmann Date: Tue, 31 Jul 2012 16:03:31 +0200 Message-ID: <4123447.LCvNL5nQdx@arges> User-Agent: KMail/4.8.4 (Linux/3.2.0-27-generic; KDE/4.8.4; x86_64; ; ) In-Reply-To: <1343739554.17140.423.camel@thinkpad> References: <4350198.FKG0AFFZGv@arges> <1343739554.17140.423.camel@thinkpad> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-MIS-Check-Sender: OK, relay allowed from this IP.OK, user martius() has authenticated himself with LOGIN. Subject: Re: [Caml-list] Segmentationfault on 64bit when called from C On Tuesday 31 July 2012 14:59:14 Gerd Stolpmann wrote: > Just a rough guess: The frametable is not initialized. Quite funny that > it crashes so quickly. (Maybe more is not initialized, maybe the heap > register, so it crashes at the first allocation.) > > You cannot just link Ocaml code without adding the frametable. This is a > description of how the stack and the CPU registers are used at runtime. > If it is missing the OCaml runtime thinks that the Ocaml code is C code, > and applies the wrong conventions. > > The -shared switch generates a library that is prepared to be loaded > with Dynlink. Dynlink registers the frametable. > > You should consider using -output-obj to create a library that can be > loaded without such tricks (see section 18.7.5 of the Ocaml manual). ocamlopt -output-obj -o camlcode.o interface.c m1.ml gcc -fPIC -g -Wall -c -I/usr/local/lib/ocaml interface.c gcc -fPIC -o test main.c camlcode.o interface.o -L/usr/local/lib/ocaml -lunix -lm -lasmrun -ldl works, but ocamlopt -o libmytest.so -output-obj interface.c m1.ml gcc -Wall main.c -lmytest -o test does not! Is it clear why it doesn't work? So I get away with static linking for now. Thanks! Georg -- ---- Georg Martius, Tel: +49 177 6413311 ----- ------- http://www.flexman.homeip.net ----------