Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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: 2005-11-20 (08:45)
From: Zhu Ping <zhuping@c...>
Subject: Re: [Caml-list] Using Frontc
Dear Madhavapeddy:

I used FrontC because I hope the parsing result w.r.t a C source code is represented in OCaml code.

I installed CIT and linked my main program with the library released in CIL.

My main program ( now is:

  open Frontc
  (* -------------------------------------- Test case for sample1.wh --------------------------------------*)
  let parse_result = Frontc.parse "/home/sand/zhuping/sample1.c"; 

The main program is successfully compiled without linking by executing: ocamlc -c -I /home/sand/cil/obj/x86_LINUX

But an error occurs when I linked the related object codes together:  

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' "

I looked into the code and found this piece of code where 'Unix' is referenced:
let gettime () : float = (Unix.times ()).Unix.tms_utime

Can anybody help me to solve this problem? 

Thank you very much for your help:)

----- Original Message ----- 
From: "Anil Madhavapeddy" <>
To: "Zhu Ping" <>
Cc: <>
Sent: Friday, November 18, 2005 5:52 PM
Subject: Re: [Caml-list] Using Frontc

> On Fri, Nov 18, 2005 at 05:22:37PM +0800, Zhu Ping wrote:
>> I'm using Frontc, which is one of the libraries released in
>> CDK, to parse C source code.
> (snip)
>> There are no source implementation/interface files with respect to
>> the corresponding files listed above.
>> Can anybody help to to solve this problem? Thank you very much for
>> your help:)
> You haven't said if you must get FrontC to work, or can use any C
> parser.  If you dont mind using another package, CIL from Berkeley
> is written in OCaml and is actively developed (and very very good).
> You can find more details at
> -- 
> Anil Madhavapeddy                       
> University of Cambridge