Hi,

> So, what I'm currently using CIL for in my tool is to preprocess the 
> source file under analysis to make it easier to analyze -- or at 
> least, that's the hope.

Ok, so you just want the merged C source as output? No compilation or 
linking?

> I'm interfacing with Cilly through Python. This is the command that I 
> am constructing:
>
> "cilly --merge --extrafiles=tmp foo.c -o foo.out"
>
> where "tmp" is the file that contains the names of the files to be 
> merged with "foo.c". Currently, it links the file that is produced as 
> a result of the merge. Adding the "-c" flag (and removing "-o 
> foo.out") prevents Cilly from linking, but for some reason, Cilly 
> stops and only produces the *.i file, so I'm not sure what exactly I'm 
> doing wrong.

Well, the problem is that the "-c" flag is interpreted by the cilly 
script which mimics gcc behavior and "compiles" the input file. 
Compiling means here that the input file is preprocessed and the 
resulting code is written to an *.o file. The actual merger (i.e. the 
CIL executable) is never invoked! In order to merge files using cilly, 
you must tell it to "link" them.
I think the only way to prevent cilly from invoking gcc for actual 
compilation and linking is to use the environment variables: 
CILLY_DONT_COMPILE_AFTER_MERGE which prevents invoking gcc for 
compilation and linking or CILLY_DONT_LINK_AFTER_MERGE which prevents 
invoking gcc for linking.

I'd construct a shell command that looks like this:
"CILLY_DONT_COMPILE_AFTER_MERGE=1 cilly --merge --extrafiles=tmp 
--merged_out=foo_merged.c foo.c"

It merges all files and puts the result in the file "foo_merged.c" 
without invoking gcc for compilation or linking.
This works perfectly if used in a shell like bash. Not sure if this kind 
of command invocation also works with python.


There is also another way to get your files merged! You can use the CIL 
executable directly rather than going through the cilly Pearl script. 
This solution, however, may be less comfortable since you must do all 
preprocessing and file handling yourself.

You can use a command like this:
"cilly.asm.exe --mergedout foo_merged.c --extrafiles tmp.txt foo.i"

It merges all files into foo_merged.c using the CIL executable. Note the 
different command line option syntax and that all input files must be 
already preprocessed.


Hope this helps.
Cheers!
Oliver


------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://ad.doubleclick.net/clk;258768047;13503038;j?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
_______________________________________________
CIL-users mailing list
CIL-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cil-users

Reply via email to