Version française
Home     About     Download     Resources     Contact us    
Browse thread
Re: [Caml-list] Using Frontc
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Zhu Ping <zhuping@c...>
Subject: Re: [Caml-list] Using Frontc
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" <matthieu.dubuget@laposte.net>
To: "Zhu Ping" <zhuping@comp.nus.edu.sg>
Cc: "Anil Madhavapeddy" <anil@recoil.org>; <caml-list@yquem.inria.fr>
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
>