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 AAA17646; Thu, 3 Jul 2003 00:45:45 +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 AAA32161 for ; Thu, 3 Jul 2003 00:45:43 +0200 (MET DST) Received: from epexch01.qlogic.org ([63.170.40.3]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id h62Mjgf02243 for ; Thu, 3 Jul 2003 00:45:43 +0200 (MET DST) Received: from epmailtmp.qlogic.org ([10.20.33.254]) by epexch01.qlogic.org with Microsoft SMTPSVC(5.0.2195.5329); Wed, 2 Jul 2003 17:44:18 -0500 Received: from [10.20.33.146] ([10.20.33.146]) by epmailtmp.qlogic.org with Microsoft SMTPSVC(5.0.2195.4905); Wed, 2 Jul 2003 17:44:18 -0500 Date: Wed, 2 Jul 2003 17:44:10 -0500 (CDT) From: Brian Hurt X-X-Sender: Reply-To: Brian Hurt To: Jung Woon Ho cc: Subject: Re: [Caml-list] Question in Linking C and Ocaml In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-OriginalArrivalTime: 02 Jul 2003 22:44:18.0645 (UTC) FILETIME=[78E7B850:01C340EB] X-Spam: no; 0.00; qlogic:01 caml-list:01 jung:99 ocamlopt:01 -output-obj:01 filenames:01 gcc:01 sched:01 fib':01 string':01 cmo:01 ocaml:01 caml:01 command:98 compile:02 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Wed, 2 Jul 2003, Jung Woon Ho wrote: > Hi, > Im trying to link some Ocaml files to my C program. And I'm having > difficulties in liking them together. > here is what I do.... > > 1) compile all my Ocaml src code with the following command. > ocamlopt -c -output-obj Is there a reason you're producing C code here? I've had good results just doing: 1) Use ocamlopt -c on ocaml files to produce .cm[oi] files (note: no -output-obj here). 2) Use gcc -c on C files to produce .o files 3) Use ocamlopt to link .cmo and .o files. > Gives me the following errors: > > sched/sched.a(modwrap.o)(.text+0x27): In function `fib': > : undefined reference to `caml_named_value' > sched/sched.a(modwrap.o)(.text+0x42): In function `fib': > : undefined reference to `copy_string' It looks like you might need to link in some Ocaml-specific libraries. Brian ------------------- 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