HOW TO Compile and Run a Plugin for SubSim
SubSim uses plugins to extend its functionallity and the GUI interface
to provide new functions to the user.
Which plugins are loaded on the simulator and if their GUI is (if part
of the plugin) visible on startup, is specified in the application
settings "settings.xml" file. Please see
for more details.
Developing and Compiling Plugins
Using Microsoft Visual Studio 7.1
Step 1. Create a blank solution.
Step 2. Create a Win32 Project. In the Win32 Application Wizard, make sure
the Application type is DLL and Additional options are set to Empty project.
Step 3. Open the project properties dialog and do the following:
- Under General, set Configuration type to DLL (should already be done, but check just in case)
- On the C++ panel, category Preprocessor, include definitions WXUSINGDLL,
WXMAKING_MY_DLL, MAKING_DLL. This will probably be reduced to a single
definition in later releases of SubSim.
- On the C++ panel, category Code Generation, set Enable C++ Exceptions to Yes,
use Runtime Library Debug Multithreaded DLL for Debug configuration and
Multithreaded DLL for Release configuration.
- On the C++ panel, category Language, set Enable Run-Time Type Info to Yes.
- On the Linker panel, category Input, add following libraries to the Additional
Dependencies: wxmsw24d.lib rpcrt4.lib comctl32.lib ws2_32.lib. (You will need
to download and compile wxWidgets, with RTTI enabled, as a Multithreaded DLL. A
precompiled version of the wxmsw24.lib and dll is here.) rpcrt4.lib,
comctl32.lib and ws2_32.lib are Windows libraries and should be installed
Step 4. Add the files plugin.h and plugin.cpp to the project. DO NOT CHANGE
THESE FILES. They provide the interface between the application and your
Step 5. Write your plugin. Examples are provided in the Plugins directory
The following are general guidelines for writing plugins:
- Derive your plugin from the Plugin class and override the CreateGui() function
to show your GUI. Provide all user interface functionality on this GUI.
- Make sure to provide a file, version and description when compiling plugins.
This information is displayed to the user and helps track changes in plugins.
- Include the line DECLARE_DYNAMIC_CLASS(classname) in the plugin
class declaration. This is part of the wxWidgets dynamic class system and is
needed so the application can create an instance of the plugin.
- Include the lines WXDLL_ENTRY_FUNCTION() and
IMPLEMENT_DYNAMIC_CLASS(class name, Plugin) in the class implementation
file (e.g. myplugin.cpp). These are needed by the application to create an instance
of the plugin.
Compile the Plugin as a .dll and add its path to the settings.xml file of SubSim as described above.