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 TAA10422; Mon, 17 May 2004 19:33:51 +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 TAA10411 for ; Mon, 17 May 2004 19:33:50 +0200 (MET DST) Received: from us19.unix.fas.harvard.edu (us19.unix.fas.harvard.edu [140.247.35.199]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i4HHXnSH004340 for ; Mon, 17 May 2004 19:33:49 +0200 Received: from [140.247.133.39] (roam133-39.student.harvard.edu [140.247.133.39]) by us19.unix.fas.harvard.edu (8.12.11/8.12.11) with ESMTP id i4HHXgqb005993; Mon, 17 May 2004 13:33:42 -0400 In-Reply-To: <9410EC84C0872141B27A2726613EF45D02A52D2D@psmrdcex01.psm.pin.safeco.com> References: <9410EC84C0872141B27A2726613EF45D02A52D2D@psmrdcex01.psm.pin.safeco.com> Mime-Version: 1.0 (Apple Message framework v613) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <5424423E-A828-11D8-89DA-0003939A19AA@fas.harvard.edu> Content-Transfer-Encoding: 7bit Cc: "" From: Michael Hamburg Subject: Re: [Caml-list] C linking on mingw Date: Mon, 17 May 2004 13:33:37 -0400 To: " " X-Mailer: Apple Mail (2.613) X-Miltered: at concorde with ID 40A8F77D.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 mingw:01 gcc:01 ocamlopt:01 ocamlc:01 ocamlopt:01 objective-c:01 henrikson:01 mingw:01 mlvalues:01 camlparam:01 camllocal:01 alloc:01 yay:99 camlreturn:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk I actually had a similar problem, and couldn't resolve it. I can link gcc into ocamlopt, and i can link either way with ocamlc, but I can't link ocaml code compiled with ocamlopt into a program whose main is in C (actually, objective-C), for exactly the same reason. Mike Hamburg On May 17, 2004, at 12:31 PM, HENRIKSON, JEFFREY wrote: > 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 = 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 > ------------------- 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