Skip to content

Developer Options

Paquet Builder includes a C compiler to generate its overheads (EXE stubs), enabling developers to extend the functionality of their packages using custom C code and/or plugins.

You can add one or more C source code files to your project. These files are compiled and linked into the final EXE file during package compilation. Functions defined in your C code can then be invoked using the Call C Function custom action during the package or uninstaller's execution.

To invoke custom C functions during the package/installer workflow, use Call C Function custom actions.

To invoke custom C functions during the uninstaller workflow, use Call C Function custom actions.

C source files are compiled twice: once for the installer and once for the uninstaller.

Compiled OBJ files are output to the Package Output Bin temporary directory.

Additional C Scripts

The "Additional C Scripts" section lets you manage the C source files to be compiled and linked into the package.

  • Absolute paths are used for the source files.
  • Each C source file must have a corresponding header file (.H) in the same folder.

Info

Sample C scripts are available in the "customccode" subfolder of Paquet Builder.

Core C Functions of Paquet Builder

Paquet Builder provides core C functions that can be invoked in your custom code.

To use these functions, include the pbcore.h header file in your C source code.

Functions

  • Define/set the value of a variable

    SetVar(const wchar_t *name, const wchar_t *val);
    

  • Get the value of a variable

    int EvalVarBuf(const wchar_t *str, wchar_t *outBuffer, int outBufferSize);
    

Example

#include "pbcore.h"

wchar_t str1[PB_MAX_STRLEN * sizeof(TCHAR)];
EvalVarBuf(L"#UninstallPrompt", str1, sizeof(str1));

Additional Linker Options

You can specify additional linker options to be used during the creation of the final overhead EXE file.

For example, if you want to import a third-party DLL file for use at runtime, specify the name of the library (.LIB) file. Place the LIB file in the "Compiler\Lib" subfolder of Paquet Builder to ensure the linker can find it.

Tutorial: How to Call a C Function

  1. Import the C Code:
    Navigate to Build -> Developer Options, click Add, and select the C source code file to import. For instance, you can use the provided simplehello.c file from the "customccode" subfolder.

  2. Create a Custom Action:
    Open the Custom Action Editor by clicking Custom Actions in the toolbar. Select the desired event (e.g., "After Welcome Screen") and click Add Action.

  3. Select the C Function:
    Choose Call a C function from the action list, then select the imported C file (e.g., simplehello.c) in "Available Scripts."

  4. Invoke the Function:
    In the "Code to invoke the function in selected script" field, enter the following code:

    ShowMyMessage();
    
    Click OK to save.

  5. Compile and Test:
    Compile the project. The C function will display a custom message box with "Hello world" (as defined in simplehello.c).