What is Absolute Code Mode?

eTPU_C |

Absolute Code Mode in Byte Craft Limited compilers generates executable code from the compiler without a linking step. Absolute Code Mode still allows you to select object code from libraries and include it as part of an application.

The compiler will read in any functions that are referenced in the eTPU_C program and are available in a library file. Simply #include the library's header file at the top of a program module, or (if there is no header) #include the library itself at the end of the main program.

For example, consider a program that uses spark, fuel, cam, and crank ETPU_functions. These statements will select the referenced eTPU functions from engine.lib and assign them to individual eTPU function numbers.

engine.lib members

#pragma ETPU_function spark @ 2;
#pragma ETPU_function fuel  @ 3;
#pragma ETPU_function cam   @ 4;
#pragma ETPU_function crank @ 5;

#include <engine.h>

When creating library files, enclose the code in #pragma library and #pragma endlibrary statements. These signal the compiler to read into the program only those functions that are referenced in the main program. Compile the library sources to an object file, and rename the object file with a .lib extension.

The significance of the .lib extension: .lib files are automatically included every time a .h file is #included in a source program. In all cases, library files should be renamed from .obj to .lib.