[ << ] [ >> ]           [Top] [Contents] [Index] [ ? ]

2. The Frontend

This chapter describes vc, the frontend for vbcc. It knows how to deal with different file types and optimization settings and will call the compiler, assembler and linker. It is not recommended to call the different translation-phases directly. vc provides an easy-to-use interface which is mostly compatible to Unix cc.

2.1 Usage

The general syntax for calling vc

    vc [options] file1 file2 ...

processes all files according to their suffix and links all objects together (unless any of ‘-E’, ‘-S’, ‘-c’ is specified). The following file types are recognized:


C source


already preprocessed C source


assembly source to be fed to the scheduler


assembly source


object file

Usually pattern matching is supported - however this depends on the port and the host system.

The options recognized by vc are:


Verbose mode. Prints all commands before executing them.


Very verbose. Displays some internals as well.


Sets the optimization level.
-O0 is equivalent to -O=0.
-O will activate some optimizations (at the moment -O=991).
-O2 will activate most optimizations (at the moment -O=1023 -schedule).
-O3 will activate all optimizations (at the moment -O=~0 -schedule).
-O4 will activate full cross-module-optimization.

Also, -O3 will activate cross-module-optimizations. All source files specified on the command line will be passed to the compiler at once. Only one assembly/object-file will be produced (by default the name is the name of the first source file with corresponding suffix).

When compiling with -O4 and -c vbcc will not produce real object files but special files containing all necessary information to defer optimization and code-generation to link-time. This is useful to provide all files of a project to the optimizer and make full use of cross-module optimizations. Note that you must use vc to do the linking. vc will detect and handle these files correctly. They can not be linked directly. Also, make sure to pass all relevant compiler options also to the linker-command.

Higher values may or may not activate even more optimizations. The default is -O=1. It is also possible to specify an exact value with -O=n. However, I do not recommend this unless you know exactly what you are doing.

-o file

Save the target as ‘file’ (default for executables is ‘a.out’).


Save the preprocessed C sources with .i suffix.


Do not assemble. Save the compiled files with .asm suffix.


Do not schedule. Save the compiled files with .scs suffix.


Do not link. Save the compiled files with .o suffix.


Keep all intermediate files. By default all generated files except the source files and the targets are deleted.


#define a preprocessor symbol, e.g. -DAMIGA or -DCPU=68000. The former syntax is equivalent to:

 #define AMIGA 1

The latter form is equivalent to:

 #define CPU 68000

Add ‘path’ to the include-search-path.


Link with library ‘ulib’.


Add ‘path’ to the library-search-path. This is passed through to the linker.


Instruct the linker to link against static libraries. This may override the default to link against dynamic libraries first.


Do not link with standard-startup/libraries. Useful only for people who know what they are doing.


Do not use names from tmpnam() for temporary files.


Invoke the instruction-scheduler, if available.


Use ‘file’ as config-file.

All other options are passed through to vbcc.

2.2 Configuration

vc needs a config file to know how to call all the translation phases (compiler, assembler, linker). Unless a different file is specified using the ‘+’-option, it will look for a file ‘vc.config’ (‘vc.cfg’ for DOS/Windows).

On AmigaOS vc will search in the current directory, in ‘ENV:’ and ‘VBCC:’.

On Unix vc will search in the current directory followed by ‘/etc/’.

On DOS/Windows it will search in the current directory.

If the config file was not found in the default search-paths and an environment variable $VBCC is set, vc will also look in $VBCC/config’.

Once a config file is found, it will be treated as a collection of additional command line arguments. Every line of the file will be used as one argument. So no quoting shall be used and furthermore must each argument be placed on its own line.

The following options can be used to tell vc how to call the translation phases (they will usually be contained in the config-file):


The preprocessor will be called like in printf(string,opts,infile,outfile), e.g. the default for vcpp searching the includes in ‘vinclude:’ and defining __STDC__) is ‘-pp=vcpp -Ivinclude: -D__STDC__=1 %s %s %s’. Note that there is an internal preprocessor, called ucpp, since V0.8, you usually don’t need this option any more.


For the compiler. Note that you cannot use vc to call another compiler than vbcc. But you can call different versions of vbcc this way, e.g.: ‘-cc=vbccm68k -quiet’ or ‘-cc=vbcci386 -quiet


The same for the scheduler, e.g.: ‘-isc=vscppc -quiet %s %s’ Omit, if there is no scheduler for the architecture.


The same for the assembler, e.g.: ‘-as=vasmm68k_mot -quiet -Fhunk -phxass -opt-pea -opt-clr %s -o %s’ or ‘-as=as %s -o %s


This is the string for the delete command and takes only one argument, e.g. ‘-rm=delete quiet %s’ or ‘-rm=rm %s


This is for the linker and takes three arguments. The first one are the object files (separated by spaces), the second one the user specified libraries and the last one the name of the resulting executable. This has to link with proper startup-code and c-libraries, e.g.: ‘-ld=vlink -x -Bstatic -Cvbcc -nostdlib -Lvlibos3: vlibos3:startup.o %s %s -lvc -o %s’ or ‘-ld=ld /usr/lib/crt0.o %s %s -lc -o %s


The same like -ld, but standard-startup and -libraries should not be linked; used when -nostdlib is specified.


This option string is inserted in the linker command before specifying the libraries, whenever an executable without debugging information and symbols should be created (AKA as a ’stripped’ executable).


This option string is inserted in the linker command before specifying the libraries when static linking was requested with option ‘-static’.

All those strings should tell the command to omit any output apart from error messages if possible. However for every of those options there exists one with an additional ‘v’, i.e. ‘-ppv=’, ‘-asv=’, etc. which should produce some output, if possible. If vc is invoked with the ‘-vv’ option the verbose commands will be called, if not the quiet ones will be used.


Format for additional libraries specified with ‘-l<lib>’. The result of printf(string,lib) will be added to the command invoking the linker. Examples are: ‘-ul=vlib:%s.lib’ or ‘-ul=-l%s

[ << ] [ >> ]           [Top] [Contents] [Index] [ ? ]

This document was generated by vb on January 3, 2015 using texi2html 1.82.