Creating an Object File

The CCompilerDriver package lets you work with C compilers that are installed on your computer. It is used automatically by the Wolfram System compiler when you set the option CompilationTarget to "C", but you can use it to build your own executables, libraries, and object files from source code written in the C language.

This section discusses some of the ways that you can use these tools to create object files. The main function to create a library is CreateObjectFile. These examples will use SymbolicC.

First, the packages are loaded.

This creates a basic C function.

This compiles the code into an object file.

If the input came from one or more files of C code, these could be given to CreateObjectFile in a list.

The extension for the generated object file is added to be compatible with the system.

CreateObjectFile lets you compile different source files with different settings.

More information on options and settings is found in the section on Configuring the Compilation.