From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: * X-Spam-Status: No, score=1.3 required=5.0 tests=AWL,SPF_FAIL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id E1E4ABB84 for ; Sun, 25 Jan 2009 21:10:21 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApoEACNWfElPrU4G/2dsb2JhbADJd4VL X-IronPort-AV: E=Sophos;i="4.37,322,1231110000"; d="scan'208";a="20136002" Received: from oak.tepkom.ru ([79.173.78.6]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/ADH-AES256-SHA; 25 Jan 2009 21:10:21 +0100 Received: from localhost (localhost [127.0.0.1]) by oak.tepkom.ru (Postfix) with ESMTP id 3A1AC3111CB for ; Sun, 25 Jan 2009 23:10:20 +0300 (MSK) X-Virus-Scanned: amavisd-new 2.6.1 (20080629) at tepkom.ru Received: from oak.tepkom.ru ([127.0.0.1]) by localhost (oak.tepkom.ru [127.0.0.1]) (amavisd-new, port 10024) with LMTP id p4UvuLrpIVp0 for ; Sun, 25 Jan 2009 23:10:19 +0300 (MSK) Received: from [192.168.1.4] (ppp78-37-146-125.pppoe.avangarddsl.ru [78.37.146.125]) (Authenticated sender: db) by oak.tepkom.ru (Postfix) with ESMTP id 045873110E0 for ; Sun, 25 Jan 2009 23:10:18 +0300 (MSK) Message-ID: <497CC71B.7000404@tepkom.ru> Date: Sun, 25 Jan 2009 23:10:03 +0300 From: Dmitri Boulytchev User-Agent: Thunderbird 2.0.0.17 (X11/20080929) MIME-Version: 1.0 To: caml-list Subject: Statically linking with C object files by bootstrap ocamlc under Cygwin. Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; statically:01 ocamlc:01 cygwin:01 ocaml:01 compiler:01 printf:01 printf:01 testc:01 ctype:01 mlvalues:01 alloc:01 camlprim:01 camlparam:01 alloc:01 val:01 Hello, just curious: why can't I produce mixed ocaml+c executable using bootstrap compiler? File test.ml: external cstring: unit -> string = "cstring";; Printf.printf "%s\n" (cstring ()) File testc.c: #include #include #include #include #include #include CAMLprim value cstring() { CAMLparam0(); CAMLlocal1(res); char * q; res = alloc_string(7); q = String_val(res); strcpy (q, "Hello!"); CAMLreturn(res); } $ gcc -I ../byterun -c testc.c $ ../boot/ocamlrun.exe ../boot/ocamlc -nostdlib -I ../boot -custom -o test testc.o test.ml ../boot/libcamlrun.a(unix.o):unix.c:(.text+0x465): undefined reference to `_flexdll_dlopen' ../boot/libcamlrun.a(unix.o):unix.c:(.text+0x478): undefined reference to `_flexdll_dlclose' ../boot/libcamlrun.a(unix.o):unix.c:(.text+0x492): undefined reference to `_flexdll_dlsym' ../boot/libcamlrun.a(unix.o):unix.c:(.text+0x4ae): undefined reference to `_flexdll_dlopen' ../boot/libcamlrun.a(unix.o):unix.c:(.text+0x4bd): undefined reference to `_flexdll_dlsym' ../boot/libcamlrun.a(unix.o):unix.c:(.text+0x4ca): undefined reference to `_flexdll_dlerror' collect2: ld returned 1 exit status File "test.ml", line 1, characters 0-1: Error: Error while building custom runtime system $ ../boot/ocamlrun.exe ../ocamlc -nostdlib -I ../boot -custom -o test testc.o test.ml $ ./test Hello! What do I do wrong? Best regards, Dmitri Boulytchev, St.Petersburg State University.