From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 8F092BB9C for ; Mon, 21 Nov 2005 09:42:18 +0100 (CET) Received: from x86unx3.comp.nus.edu.sg (x86unx3.comp.nus.edu.sg [137.132.80.24]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id jAL8gGjh023578 for ; Mon, 21 Nov 2005 09:42:17 +0100 Received: from e500c.comp.nus.edu.sg (e500c.comp.nus.edu.sg [137.132.90.68]) by x86unx3.comp.nus.edu.sg (8.9.1-20030924/8.9.1) with SMTP id QAA16256; Mon, 21 Nov 2005 16:42:04 +0800 (GMT-8) Received: from sn40.comp.nus.edu.sg(137.132.80.15) by e500c.comp.nus.edu.sg via csmap id cbd54280_5a6a_11da_8116_003048298555_4280; Mon, 21 Nov 2005 16:42:49 +0800 (SGT) Received: from zhuping (soccf-pls-037.ddns.comp.nus.edu.sg [172.18.179.29]) (authenticated bits=0) by sn40.comp.nus.edu.sg (8.13.1/8.13.1) with ESMTP id jAL8feag021238 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NOT); Mon, 21 Nov 2005 16:42:03 +0800 (SGT) Message-ID: <000e01c5ee77$724858b0$1db312ac@comp.nus.edu.sg> From: "Zhu Ping" To: Cc: "Anil Madhavapeddy" , References: <002c01c5edae$afd08d20$1db312ac@comp.nus.edu.sg> <43806DF3.1000806@laposte.net> Subject: Re: [Caml-list] Using Frontc Date: Mon, 21 Nov 2005 16:41:35 +0800 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="gb2312"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2527 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527 X-Miltered: at concorde with ID 43818868.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 ocamlc:01 ocamlc:01 -custom:01 usr:01 lib:01 ocaml:01 usr:01 lib:01 ocaml:01 cmo:01 cmo:01 util:01 clist:01 toplevel:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 I have successfully compiled my main program by executing the following two commands sequentially: $ ocamlc -c -I /home/sand/cil/obj/x86_LINUX main.ml $ ocamlc -o main -custom /home/sand/cil/obj/x86_LINUX/perfcount.o /usr/lib/ocaml/unix.cma /usr/lib/ocaml/str.cma -I /home/sand/cil/obj/x86_LINUX/ pretty.cmo trace.cmo errormsg.cmo cabs.cmo cabsvisit.cmo escape.cmo cprint.cmo patch.cmo stats.cmo lexerhack.cmo machdep.cmo clexer.cmo cparser.cmo inthash.cmo util.cmo clist.cmo cilversion.cmo alpha.cmo cil.cmo cilutil.cmo cabs2cil.cmo frontc.cmo main.cmo But you can't see anything by just typing "./main" To print the value of "parse_result" defined in my main.ml, I first build my toplevel interpretator by executing: $ ocamlmktop -o mytoplevel -custom /home/sand/cil/obj/x86_LINUX/perfcount.o /usr/lib/ocaml/unix.cma /usr/lib/ocaml/str.cma -I /home/sand/cil/obj/x86_LINUX/ pretty.cmo trace.cmo errormsg.cmo cabs.cmo cabsvisit.cmo escape.cmo cprint.cmo patch.cmo stats.cmo lexerhack.cmo machdep.cmo clexer.cmo cparser.cmo inthash.cmo util.cmo clist.cmo cilversion.cmo alpha.cmo cil.cmo cilutil.cmo cabs2cil.cmo frontc.cmo main.cmo Then in this new toplevel the value of "parse_result" is propoerly displayed You can refer to the book "Developing Applications With Objective Caml" (page 322) to know more details about building a new toplevel interpretator which can use an external C function in the toplevel interactive loop. The pity now is the CIL format seems too complicated for me. I like the data structure defined in an earlier version of FrontC (http://casse.hugues.free.fr/projects/frontc.html) better:). However I still have problems in compiling FrontC sources downloaded from the site http://casse.hugues.free.fr/projects/frontc.html. Did anyone successfully install FrontC in Linux/Unix? Anyway, thank you all for your help:) ----- Original Message ----- From: "Matthieu Dubuget" To: "Zhu Ping" Cc: "Anil Madhavapeddy" ; Sent: Sunday, November 20, 2005 8:37 PM Subject: Re: [Caml-list] Using Frontc > >> ocamlc -o main -I /home/sand/cil/obj/x86_LINUX/ pretty.cmo trace.cmo >> errormsg.cmo cabs.cmo cabsvisit.cmo escape.cmo cprint.cmo patch.cmo >> frontc.cmo main.cmo >> "Error while linking /home/sand/cil/obj/x86_LINUX/patch.cmo: Reference >> to undefined global 'Unix' " > > Try this : > ocamlc -o main -I /home/sand/cil/obj/x86_LINUX/ unix .cma pretty.cmo > trace.cmo errormsg.cmo cabs.cmo cabsvisit.cmo escape.cmo cprint.cmo > patch.cmo frontc.cmo main.cmo > > Salutations > > Matthieu >