Add Ins

An addin is a Standard DLL that exports tbCreateCompilerAddin and returns an object implementing the AddIn interface. Through the Host object the IDE passes at startup, an addin can reach the toolbar, the IDE’s menus, tool windows, debug console, current project, the Project Explorer, keyboard shortcuts and themes, and can add an editor of its own for a kind of file. The tbIDE package documents the full API.

Add-ins that ship with the IDE

These add-ins are in the install’s addins\win32 and addins\win64 folders, so every project loads them:

Once a project is open, the Add-Ins menu lists them:

The Add-Ins menu listing five add-ins, each with a tick: ICO Editor, Hex Editor, GlobalSearchAddIn AddIn, Diff Compare and Data Explorer.The Add-Ins menu listing five add-ins, each with a tick: ICO Editor, Hex Editor, GlobalSearchAddIn AddIn, Diff Compare and Data Explorer.

The Help Add-In is not one of them: it comes from this documentation, and you install it yourself.

Writing an add-in

The New Project dialog’s Samples section holds the add-in samples, numbers 10 to 16 and 24 to 27, the cards named twinBASIC IDE Addin, alone or with a variant in brackets (see Samples), covering patterns from simple toolbar buttons to HTML DOM-backed tool windows and editors of their own. Samples 15 and 24 to 27 are the projects of the add-ins that ship with the IDE. Each is a complete addin project, with the tbIDE package referenced and the build path set, and Sample 10, twinBASIC IDE Addin, is the plainest one to start from. A project started from the Standard DLL template has neither setting: Building and loading an addin says what to add. Community addins are listed on the Community page, and other programs that twinBASIC users share on the Community tools page.

Installing an add-in

twinBASIC supports two addin install locations. The IDE install directory is available to all user accounts on the machine but may require reinstallation after an IDE update. A per-user application data folder persists across IDE upgrades and requires no administrator rights.

To install an addin via the IDE install directory, unzip and copy each architecture DLL to the matching folder:

\twinBASIC_IDE_BETA_xxx\addins\win32\

\twinBASIC_IDE_BETA_xxx\addins\win64\

To install it for your own user account instead, copy each architecture DLL to the matching folder under your application data. The IDE creates both folders when it starts:

%APPDATA%\twinBASIC\addins\win32\

%APPDATA%\twinBASIC\addins\win64\

In either location the DLL goes in one of the two architecture folders. A DLL placed directly in addins\ is not loaded. The IDE loads the addins in the folder that matches the project’s build target, which is win32 unless the project is set to build for win64, so an addin that should load either way needs a build of each. Switching the build target restarts the compiler, which then loads the addins in the other folder.

When an addin does not load

The DEBUG CONSOLE says why, on a line that starts with the DLL’s file name in brackets:

Message Cause
Failed to load addin. LoadLibrary() failed. Windows could not load the DLL: for example, a 32-bit build in a win64 folder.
Failed to load addin. Entry point not found. Addin may have been compiled for a newer version of the twinBASIC IDE. The DLL exports none of the names this IDE looks for; see the tbIDE package.
Failed to load addin. Entry point 'tbCreateCompilerAddin' call failed. The addin’s tbCreateCompilerAddin returned Nothing.
Failed to load addin. Entry point 'tbCreateCompilerAddin' returned an object that does not implement interface IAddInV1. It returned an object that does not implement AddIn.

The Add-Ins menu still lists such a DLL, as Unknown Addin.

Add-ins from the community

The add-ins that twinBASIC users write and share are listed on the Community add-ins page of the Community section. Programs that help with twinBASIC and are not add-ins are on its Community tools page.


Table of contents