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 SAA06625; Mon, 17 May 2004 18:31:16 +0200 (MET DST) 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 SAA06614 for ; Mon, 17 May 2004 18:31:15 +0200 (MET DST) Received: from rdcmx1.safeco.com (rdcmx1.safeco.com [12.144.132.31]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i4HGV3SH028561 for ; Mon, 17 May 2004 18:31:14 +0200 Received: from psmrdcex03.psm.pin.safeco.com (Not Verified[12.144.134.38]) by rdcmx1.safeco.com id ; Mon, 17 May 2004 09:31:02 -0700 Received: from safeco.com ([168.147.237.20]) by psmrdcex03.psm.pin.safeco.com with Microsoft SMTPSVC(5.0.2195.6713); Mon, 17 May 2004 09:31:02 -0700 X-MimeOLE: Produced By Microsoft Exchange V6.0.6487.1 MIME-Version: 1.0 Subject: [Caml-list] C linking on mingw Date: Mon, 17 May 2004 09:31:01 -0700 Message-ID: <9410EC84C0872141B27A2726613EF45D02A52D2D@psmrdcex01.psm.pin.safeco.com> Thread-Topic: C linking on mingw Thread-Index: AcQ8LFelts3Mfi22Sa2XuONSOPc4iQ== From: "HENRIKSON, JEFFREY" To: Cc: X-OriginalArrivalTime: 17 May 2004 16:31:02.0460 (UTC) FILETIME=[57ED17C0:01C43C2C] content-class: urn:content-classes:message Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Miltered: at concorde with ID 40A8E8C7.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; mingw:01 henrikson:01 ocamlopt:01 mingw:01 mlvalues:01 camlparam:01 camllocal:01 alloc:01 yay:99 camlreturn:01 val:01 alloc:01 runtime:01 gcc:01 -mno-cygwin:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk I am having trouble linking ocamlopt code with C via a dll on mingw. Here is a simple reproduction of the problem: Msgbox.c: #include #include #include value c_msgbox(value i) { CAMLparam0(); CAMLlocal1(s); s =3D alloc_string(15); MessageBox(NULL,"yay","hello",MB_OK); CAMLreturn (Val_int(0)); } (Yes, the alloc_string doesn't do anything, it's only necessary to reproduce the situation. Suppose I have a real function that actually depends on the runtime.) gcc -mno-cygwin -I /cygdrive/c/ocaml/lib -I /usr/include/w32api -c msgbox.c gcc -mno-cygwin -shared /cygdrive/c/ocaml/lib/libasmrun.a msgbox.o -o msgbox.dll msgbox.o(.text+0x11):msgbox.c: undefined reference to `_local_roots' msgbox.o(.text+0x20):msgbox.c: undefined reference to `_local_roots' msgbox.o(.text+0x2b):msgbox.c: undefined reference to `_local_roots' msgbox.o(.text+0x52):msgbox.c: undefined reference to `_alloc_string' msgbox.o(.text+0x84):msgbox.c: undefined reference to `_local_roots' collect2: ld returned 1 exit status What makes this link? I am needing to do an ocamlopt program. The only file which resolves the linking above on my mingw distribution is ocamlrun.dll, which of course isn't meant for asm code linking. Specifically, it crashes before running a single line of code. I seem to remember there was an easy way to do this on the MS based port when I had it set up. PS: can someone please confirm/correct my understanding of these files: - ocamlrun.dll: the bytecode runtime. - ocamlrun.a: its import library. - libasmrun.a: the runtime for asm binary programs with entry point. - stdlib.a: utilities to support the Pervasives and standard libaries. Are there other related files? Must one have two separate code stub dlls for ocaml and ocamlopt? Thank you, Jeff Henrikson ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners