Resources | developer.brewmp.com Resources | developer.brewmp.com

Developer

resources

Running the CIF compiler

The CIF compiler is a command-line utility that takes one or more CIF files as arguments and creates a single MIF file and the stub C code required by the module.

Command line usage

The arguments enclosed in square brackets are optional. By default, cifc does not produce any output, and will only check the CIF files for errors. The following is cifc syntax.

cifc [-mod mod_name ] [-mif mif_file_name] 
     [-src src_file_name]
     [-pre pre_file_name] [-input_mif file_name] 
     [-modci mod_createinstance_func] [-s] [-d] 
     [-I path_name] [-M] [-3] [-Werror] CIF_Files
Option Description
-mod mod_name Specifies the current output module name, which is used in the generated stub code
-mif mif_file_name Specifies the MIF name.
-src: src_file_name Specifies the name of the file where cifc will output the necessary C code stub for the module.
-pre pre_file_name Specifies the name of the file to output the pre-processed CIF.
-input_mif file_name Imports the contents of the input binary (.mif) file. See the note below.
-modci mod_createinstance_func Specifies the function to be called to create the module entry class. If not specified, the name "mod_NewIMod" will be used and the user must provide an implementation for this code. Brew MP provides a library that implements this function, and the module code may link with it if it is not interested in providing its own implementation.
-s Generate code for a static stub. Static modules are built into target images and don't have a separate MIF file. The static stub code provides a data structure called a1StaticMod to represent the the MIF file converted into a byte array and the stub code.
-d Generate stub code for the dynamic module. The stub code in this case has the CreateInstance function for the module.
-I path_name Specifies the include path to be searched for any included files. The space may be omitted.
-M Output a make-compatible .dep file to stdout.
-3 Create 3.x compatible registry entries, where possible. Warnings will be emitted for SysRsc entries that cannot be placed in the BREW 3.x-compatible handler's MIF record.
-Werror Treat all warnings as errors.
CIF_files A list of input CIF files.
-bar bar_file_name Instructs the CIFC compiler to create a BAR file as output and specifies the BAR file name

Note: -input_mif file_name option: The resulting MIF's header may have an incorrect number of applets and notifiers, mime types, etc. This may be problematic on BREW applications older than 4.0. The only CIF declaration the decompiler understands is the Class declaration, so classes and privileged classes should be correctly counted. Error checking over the input data from the MIF is unavailable. So, the user may end up adding conflicting ACLs, invalid service and applet declarations, and so forth. However, duplicate Class declarations are caught. This feature can be used to decompile a MIF file into a CIF file via the -pre output option:

cifc -input_mif foo.mif -pre foo.clif

This feature is available starting with cifc version 1.1.0.