GRID CARTOGRAPHER 4
Shortcuts

GCBuild

2019-04-13

Functions to compile and link multiple scripts into complex applications and provide support for code libraries.

Compile

GCBuild.Compile( source_buffer: int, name: string ): table

Compiles a plain-text Squirrel script stored in source_buffer into a binary byte-code 'object file'. The given name string is used for any error messages. Once compilation is complete, the result is stored in a table with the following optional fields:

Key Value
error: string If compilation errors were found, this string will exist in the table and contain a human readable error message followed by a newline.
output: int If compilation was successful, this key will be present in the result table. It is a handle to a GCBuffer object containing object code, typically to be written to disk. The buffer must be manually destroyed with GCBuffer.Destroy when no longer needed.

Link

GCBuild.Link( objects: array ): table

Combines a number of compiled object files into a single Grid Cartographer Executable (a .GCX file). The objects array is an array of tables providing information about the object files to link, with the following keys:

Key Value
name: string The file name (or other identifier) of the object file, for use as a prefix in any error messages generated by the linker.
buffer: int GCBuffer handle for the object file data generated by the compiler.

If there are invalid items in the array or the table keys are not all present, then this function will return GCERR_INVARG. Otherwise it will return a table with the following slots:

Key Value
error: string If link errors were found, this string will exist in the table and contain a human readable error message followed by a newline.
output: int If linking was successful, this key will be present in the result table. It is a handle to a GCBuffer object containing executable code, typically to be written to disk. The buffer must be manually destroyed with GCBuffer.Destroy when no longer needed.