PureBasic Header Generator


Will read a PureBasic source file (*.pb) and generate a header out of it (*.pbi).
Declare statements are generated for every procedure automatically.

This program also works with SpiderBasic.


PureBasic is a great language but I was always annoyed about the fact I could never choose where I would locate my Procedures. If I wished to use a Procedure somewhere I would have to move it above of the Procedure that was going to call it.

The Declare statement allows to tell the compiler specific Procedures are going to exist and to find them but writing them over and over and fixing arguments is not only a pain but makes your source look like a mess. That’s the reason I required an automatic header generator for PureBasic. I hope you too will enjoy the new freedom thanks to this little tool!

Henry de Jongh


Under “Tools” in the PureBasic IDE add a new tool called “PBHGEN”.

At Commandline select your copy of PBHGEN.exe.
At Arguments type “%FILE”.
At Event to trigger the tool select Sourcecode Saved.


Ensure you include your headers in the Source Code using:

IncludeFile #PB_Compiler_File + "i" ;- PBHGEN

To use automatic header generation in modules also use:

Module MyModule
    IncludeFile #PB_Compiler_File + "i" ;- PBHGEN


At the moment if you wish to have a procedure with structured List/Array/Map arguments, you will have to put that procedure above the code where you call it from.
This does not apply when using basic types and is a limitation of PureBasic.

Version 5.71

  • Fixed double colon operator inside procedure arguments OnVstMain(*Effect.Vst2::AEffect).

Version 5.42

  • Added SpiderBasic header generation support.

Version 5.42

  • Fixed a comment after EndProcedure / EndModule / EndMacro skipping the next procedure declaration.
  • Now ignoring content between Macro / EndMacro statements.

Version 5.31d

  • Fixed case where the compiler directives failed when a module is declared above global procedures.

Version 5.31c

  • Using compiler directives to remove the need of multiple files for modules.

Version 5.31b

  • Improved parsing engine to comply with latest PureBasic syntax.
  • Optimized header file content and size.
  • Now supports any amount of spaces in front of a procedure.
  • Treats a colon seperator as a new line to allow multiple declarations on a single line.
  • Added support for module header generation (requires additional files and include lines in source code).

Version 5.31

  • Now naming version after PureBasic’s version when possible.
  • Added support for Runtime procedure statements.
  • Added support for case independent keyword detection.
  • Improved ProcedureDLL and ProcedureCDLL with appropriate DeclareDLL and DeclareCDLL.

Version 0.9

  • Fixed issue with multiline arguments. Thanks majikeyric for pointing this out.

Version 0.8

  • Fixed issue with a space in the directory/file path of source file.

Version 0.7

  • Stops when encountering the statement seperator “:” or comment “;” operators.

Version 0.6

  • Fixed issue where array arguments would still have impossible structures.
  • Added support for structured List/Array/Map arguments with some conditions.
  • Added support for all basic types when used with List/Array/Map arguments.

Version 0.5

  • Fixed issue where a *pointer.structure had no default parameter.
  • Fixed issue with a string as custom parameter, it was not escaped.

Version 0.4

  • Fixed issue where a *pointer would cause further Procedure Parameters to lose their types.

Version 0.3

  • Fixed issue with Structured List/Array/Map in Procedure Parameters.

Version 0.2

  • Fixed issue with Structure Pointers in Procedure Parameters, transforms to Pointers now.

Version 0.1

  • Initial Design

Leave a Reply