Developer Options¶
Paquet Builder uses a C compiler to generate its overheads (EXE stubs), so developers can use this opportunity to extend functionality of their packages by using custom C code and/or plugins.
You are able to add one or more C source code files to your Paquet Builder project. When compiling the package, Paquet Builder will compile all specified C source files and link them into the final EXE file. Functions defined by the C source files can then be invoked with the Call C Function custom action during the execution of the package and/or the uninstaller.
To invoke custom C functions for the package / installer, use Call C Function custom actions in all events related to the package workflow.
To invoke custom C functions for the uninstaller, use Call C Function custom actions in all events related to the uninstaller workflow.
C source files are compiled twice (for the installer and for the uninstaller).
When compiling C source files, OBJ files are output in the Package Output Bin temporary directory.
Additional C Scripts¶
The list lets you manage C source files that will be compiled and linked.
Absolute paths are used.
Moreover, each C source file must have its corresponding header (.H file) in the same folder.
Info
You can find two samples in the "customccode" subfolder of Paquet Builder.
Core C functions of Paquet Builder¶
Some C core functions of Paquet Builder can be invoked in your own C code. Be sure to include the "pbcore.h" header so that the C compiler can recognize these functions.
The following core functions are currently available:
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 pass additional options to the linker program that links all OBJ and RES files into the final overhead EXE file.
For instance, if you want to import a third-party DLL file to be used by your package at runtime, specify the name of the library (.LIB) file of the DLL. Be sure to place the corresponding LIB files in the "Compiler\Lib" subfolder of Paquet Builder, so that the linker can find them.
Tutorial: how to call a C function¶
- In Paquet Builder, go to Build -> Developer Options, click Add and select the C source code file to import. For instance, the one that ships with Paquet Builder called simplehello.c - you can find in the "customccode" subfolder of Paquet Builder.
- Click "Custom Actions" in the toolbar to open the Custom Action editor, choose the event you want (After Welcome Screen) and add a new action with "Add Action".
- Select "Call a C function" in the list and validate with OK.
- In "Available Scripts", choose the C source code file imported above (simplehello.c).
- In "Code to invoke the function in selected script", type the following code and validate with OK.
ShowMyMessage();
Now you can compile your project and you'll see that the C function displays a custom message box with "Hello world" (as defined in simplehello.c)