Plugin Development
From BB4Win Wiki
Contents |
[edit] BBLean
BBLean SDK can be downloaded from BBLean homepage[1].
[edit] SDK
The SDK contains the following files:
Files: ------ bbSDK.dll The compiled plugin. # --- common --------------------------------------------------------- bbSDK.cpp A sample plugin source code BBApi.h bblean API header file (0.0.9X compatible) # --- MINGW-GCC ------------------------------------------------------ bbSDK.dev DevC++ project file bbSDK.layout DevC++ editor state. libBlackbox.def blackbox import definition file. devcpp_makefile.inc include makefile, generates the import library Tested with DevC++ 4.9.8.0 / GCC 3.2.3 / W32api 2.4 # --- MSC ------------------------------------------------------------ makefile-msc nmake-file for MSVC 6.0 blackbox.lib blackbox import library for MSC compile-msc.bat makes the plugin # --- BCC55 ---------------------------------------------------------- makefile-bcc makefile for BCC55 (free borland compiler) blackbox_bor.lib blackbox import library for BCC bb(slit)plugin.def export definition files for BB-Plugins compile-msc.bat makes the plugin
[edit] Getting Started
The best way to learn plugin development, is to start with the sample plugin included with the SDK.
[edit] Environment Setup
[edit] MS Visual Studio.Net 2003
In order to compile the sample plugin from the SDK, it necessary to set the MSCDIR environment variable in the compile-msc.bat script. The easiest way to setup a proper environment is to run the Visual Studio .NET 2003 Command Prompt tool from the Visual Studio programs group in start menu and change working directory to the plugin development directory. In this case it is necessary to comment out the MSCDIR assignment in the batch file:
REM SET MSCDIR=C:\MSC %MSCDIR%\bin\nmake -f makefile-msc
[edit] Code::Blocks
To make the sample plugin compile in Code::Blocks with GCC/Mingw, you first have to create the librarys by using:
path %PATH%;c:\path\to\gcc dlltool -d libBlackbox.a -l libBlackbox.def -D c:\path\to\Blackbox.exe
Copy these files (libBlackbox.a and libBlackbox.def) into your lib folder. Next start code::blocks and create a new project. Make sure that the project compiles into a Dynamic Link Library (DLL) and bring up the build options by right-clicking the project in the project management panel. Under "Linker settings", add the libBlackbox.a file to the Link libraries list. Finally, add the source files by right-clicking the project.
Note: On my system, the gcc tools are located in d:\dev\devcpp\bin and the lib folder is at d:\dev\devcpp\lib. I sorted it like this because code::blocks automatically detects the compiler and tools included with dev-cpp at startup, and hence it saves me a lot of trouble setting it up.
For a quick tutorial on how to set up Code::Blocks with a compiler to create your own 100% free open source development studio, check Setting Up CodeBlocks.
[edit] Debugging
Debugging plugins can be a bit tricky for new developers. DBGView from Sysinternals can help a lot [2]. An example debug output function (dbg_printf) is given in the example.
