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 mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 5BC547EE25 for ; Fri, 14 Jun 2013 21:17:06 +0200 (CEST) Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of omeragacan@gmail.com) identity=pra; client-ip=74.125.82.46; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="omeragacan@gmail.com"; x-sender="omeragacan@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of omeragacan@gmail.com designates 74.125.82.46 as permitted sender) identity=mailfrom; client-ip=74.125.82.46; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="omeragacan@gmail.com"; x-sender="omeragacan@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-wg0-f46.google.com) identity=helo; client-ip=74.125.82.46; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="omeragacan@gmail.com"; x-sender="postmaster@mail-wg0-f46.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AkADAI1ru1FKfVIujWdsb2JhbABbgzlJr3WOUYECCBYOAQEBAQcLCwkSBiSCIwEBBAFAARsRDAEDAQsGBQsDOCIBEQEFARwGiA4BAwkGnF6MS4J/hCEKGScNWId0AQUMjwkzB4NgA4kajieBKY40FimEODk X-IPAS-Result: AkADAI1ru1FKfVIujWdsb2JhbABbgzlJr3WOUYECCBYOAQEBAQcLCwkSBiSCIwEBBAFAARsRDAEDAQsGBQsDOCIBEQEFARwGiA4BAwkGnF6MS4J/hCEKGScNWId0AQUMjwkzB4NgA4kajieBKY40FimEODk X-IronPort-AV: E=Sophos;i="4.87,868,1363129200"; d="scan'208";a="17858045" Received: from mail-wg0-f46.google.com ([74.125.82.46]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 14 Jun 2013 21:17:05 +0200 Received: by mail-wg0-f46.google.com with SMTP id c11so819251wgh.25 for ; Fri, 14 Jun 2013 12:17:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=LgoYCdyxGlzQyiN/7AhbwNtV9lw0T5BTdtd4ZOnbCIM=; b=Bs2oC2SSFJhaW+WeiYoO4vISWEXI0oFXObu+mkGwX1EOeai2EuhOGoAzxHcaiP7zFN 7wdqX6x3VpN1kIJX9oWd1RhNHdBPuoWcH/pQ0VooIpiH98SZfLmNruQk9LZ8wMXd+W02 7o6Y2tN4hSJjUIgY+FrF3IU45waeCh5f7HWLCKbXFJQ7AZ6OTOiaAQ/X6vbLJJej0PvB BQjqOQn2eZjLyAlg3D1bFBXcD9fLyl1zCT6WUgoWvvkg2SmsG2W8kOryWkC1tX4p0ebr x8LtT5WFAx6U0soIaYUrR81PNq/tCAsIhk/UFhPwFGElhNIMB7gIUzHy09zHXejEWo1h AWtA== MIME-Version: 1.0 X-Received: by 10.194.242.229 with SMTP id wt5mr2243985wjc.36.1371237425311; Fri, 14 Jun 2013 12:17:05 -0700 (PDT) Received: by 10.216.172.72 with HTTP; Fri, 14 Jun 2013 12:17:05 -0700 (PDT) In-Reply-To: References: Date: Fri, 14 Jun 2013 22:17:05 +0300 Message-ID: From: =?ISO-8859-9?Q?=D6mer_Sinan_A=F0acan?= To: Dawid Toton Cc: caml-list@inria.fr Content-Type: text/plain; charset=ISO-8859-9 Content-Transfer-Encoding: quoted-printable Subject: Re: [Caml-list] Re: OCaml binary formats -- how are they linked? Dawid, thanks for your answer. It really helped. And now I have some more questions(that's a part of learning process, right= ? ;-) > You can see what actually happens with > > ocamlopt -verbose -c a.ml > ocamlopt -verbose -cc 'gcc --verbose' a.cmx I added -verbose parameter in my Makefile, and output was interesting, it called gcc! At first I thought it's called just for linking purposes, but later I realized there is also a C file passed to gcc. It first passed output parameter (`-o executableName`), later some -L parameters. And after that it passed the file `/tmp/camlprimcb16b7.c`. What is that file? I couldn't read it because it was deleted after compilation. Later some parameters are passed for statically linking(-ldl, -lm, -lpthread, -lcamlrun etc.). > strace -e trace=3Dopen ./myexecutable This is so great .. A format-independent way to see dynamically linked libraries. Thanks for the tip! (btw, is there a different name given to the process of dynamically loading and linking libraries with `dload` like system calls? is it also called `dynamically linked`?) > Bytecode is compiled to a files with #! prefix. Interesting, I just tried reading an OCaml executable created with ocamlc, and it had a ELF header. Am I compiling to my program to native by mistake? I'm not calling ocamlopt, only ocamlc. Thanks again, --- =D6mer Sinan A=F0acan http://osa1.net