Using gec | ![]() ![]() |
The usual way to invoke gec is as follows:
gec ecf_filenameThis will read the description of your program in the ECF file ecf_filename, compile it and invoke the back-end C compiler on the generated C code as explained below. Here is the list of options that can be used with gec:
An Ace file contains the description of the Eiffel program to be compiled. gec is able to read the same Ace files as ISE Eiffel. So if you already have your Ace files the only thing you have to do is to instruct gec to use FreeELKS kernel classes instead of ISE EiffelBase kernel classes. To do so you just have to replace the EiffelBase clusters in your Ace file by:
all free_elks: "${GOBO}/library/free_elks"If you are new to Eiffel and don't know what an Ace file is, please have a look at this description from the documentation of the Gobo Eiffel Tools Library on which gec is based.
gec translates your Eiffel programs into C code. This C code is then passed to a back-end C compiler to generate an executable. By default gec uses Microsoft Visual C cl on Windows and GNU gcc on other operating systems such as Linux. This section explains how to override this default if you want to use another back-end C compiler or if you want to specify different C compilation options.
For each C compiler that you want to use as back-end C compiler, you should provide a config file that should be located in $GOBO/tool/gec/config/c/. Here is an example of such config file, gcc.cfg for the gcc compiler:
This config file is used by gec to generate a .bat file on Windows or a shell script on other platforms that will be executed to compile the generated C code. The variable "cc" represents the command-line template to turn C files into object files, and "link" to turn object files into executables. The variables "$cflags", "$includes", "$c" in the first template, and "$lflags", "$exe", "$objs" and "$libs" in the second template will be replaced by appropriate values by gec. Next, the variables "obj" and "exe" represent the file extensions for object files and executables on the platform on which this C compiler will be invoked. And finally we find C compilation and linker flags that should be used when gec is invoked with or without the command-line option "--finalize". Note that Eiffel-style comments, starting with "--", can be included in these config files.cc: gcc $cflags $includes -c $c link: gcc $lflags -lm -o $exe $objs $libs obj: .o exe: cflags: lflags: cflags_finalize: -O2 lflags_finalize:
There are several ways to instruct gec to use a different back-end C compiler. You can either write the name of the chosen C compiler in the file $GOBO/tool/gec/config/c/default.cfg. You might need to create this file if it does not exist yet. Alternatively you can specify the name of the chosen C compiler in the environment variable $GOBO_CC. Let's say that the name of your chosen C compiler is my_cc. gec will then look for the config file $GOBO/tool/gec/config/c/my_cc.cfg.
Copyright © 2006-2018, Eric Bezault mailto:ericb@gobosoft.com http://www.gobosoft.com Last Updated: 5 March 2019 |
![]() ![]() ![]() ![]() |