HOW TO Compile and Run a HighLevel Program for SubSim

This document explains how to compile a controler program with the RoBios HighLevel API and HDT for the EyeBotPlugin in SubSim.

SubSim and the Eyebot API

The EyeBot Plugin extends SubSim with the EyeBot RoBios HighLEvel API. To run an Eyebot controller program, you need the actual program compiled as a .dll and a additional HDT for defining low-level attributes for sensors and actuators

Eyebot RoBios

The main function of SubSim is to serve as a debugging platform for controller programs specifically for microcontrollers such as the Eyebot. The Eyebot operating system RoBIOS is emulated by SubSim, so a program written to run on an Eyebot will function very similar when run by SubSim. RoBiOS has many system calls to support external devices such as motors, servos, position sensors, A/D input, electronic compass, etc... SubSim also defines these functions with a global scope, so they are available everywhere inside of SubSim including user programs. The RoBIOS system calls are implemented through a set of Plugins that interact with the internal physics simulation and graphical interface of SubSim. Because RoBIOS is implemented as the EyeBot Plugin, it is a good guide for those wishing to implement emulated system calls for other embedded operating systems. (NOTE: Because a custom user program is executed by SubSim on a PC, all the system calls of the native OS are available, Windows for instance. The user has to be careful not to rely on functions which may not be present on the target embedded platform).

Eyebot HDT - Hardware Description Table

The Eyebot uses a mechanism called the Hardware Description Table, or HDT, for defining low-level attributes for sensors and actuators. SubSim also supports the HDT format and it is necessary for writing programs that use any sensors or actuators. For more information see HDT HOW TO

Compiling the controler program

To develop & compile your controller program you can either use Microsoft Visual Studio 7.1 or your favorite texteditor with MinGW as compiler.

Using Microsoft Visual Studio 7.1

Create a new solution to hold your code projects. For each program you write, define int main(int,char**) and a HDT file in separate projects.

  1. Create a new Win32 project. In the Win32 Application Wizard Application Settings, set Application type to DLL and Additional options to Empty project.
  2. Open the Project Properties and select the Configuration Properties -> Linker -> Input. Add EyebotLib.lib to the Additional Dependencies.
  3. Add the path to EyebotLib.lib on your system in the Configuration Properties -> Linker -> General -> Addition Library Directories.
  4. Select Configuration Properties -> C++ -> General. Add the path to API-Eyebot.h on your system in Configuration Properties -> C++ -> General -> Additional Include Directories. For the default SubSim configuration, EyebotLib.lib is in subsim/lib/, and API-Eyebot.h is in subsim/include/.
  5. Set the runtime library (C/C++ -> Code Generation) to Multi-Threaded DLL

Some configurations of Visual Studio will not define _WINDLL. This setting must be defined in order to export your programs main function. If the project has been correctly set up, you should see the message "Main is being automatically exported" when you compile.

Using MinGW

MinGW is a collection of freely available and freely distributable Windows specific header files and import libraries combined with GNU toolsets that allow one to produce native Windows programs that do not rely on any 3rd-party C runtime DLLs. It is a free package available under
For program development jEdit is recommended as text editor. Togehter with the jEdit Console Plugin it is very handy to compile your program.

  1. Create new directory in one of the subsim examlpe directories.
  2. Copy one of the makefiles from an highlevel example in your directory.
  3. Write your programm with the ending .cpp
  4. Run the command mingw32-make under a command-shell in your directory (make sure the MinGW path is set).

if you are tired of typing mingw32-make all the time. Create a make.bat file with mingw32-make %1in any dir which is in the path (e.g. the minGW bin dir)

Executing a program in SubSim

To execute the program you have to add the program name in a .sub SimulationFile. And load the file in SubSim. See Manual and HOWTO SUBFILES for more details on that


Example programs, including a VC71 workspace can be found in the examples/high-level directory.