Using the Examples


The SDK comes with a few default examples to get started. These can be used to practice building and running custom code, as well as for reference when creating new projects. These can be found within the SDK installation under the examples folder. The developer shell begins in this directory by default.

The main use of the developer shell is to compile code, so a good first step is to practice by compiling the examples. There a few ways to do this.

Build a Single Example

To build a single example, use the bmake command and pass it the make (.mke) file for the project. This is the same process for building individual custom projects written by users.

To demonstrate, building the ManagedSDKExample project requires the following command and produces the following output:

bmake ManagedSDKExample/ManagedSDKExample.mke

The output shows that the example built successfully, so now it is ready to run within OpenRoads Designer.

Note: To debug examples written with the Managed SDK, they must be built within Visual Studio. This is covered in the Debugging a Managed Project section.

Build All Examples

To build all the default examples, run the BuildAllExamples.bat file inside the examples directory.

This script will cycle through every project in the examples directory of the SDK installation and build it.

 

Running Custom Projects in OpenRoads Designer

Once a project is built through the developer shell, it can be run in OpenRoads Designer. This is done by loading the project as a keyin. Creating projects that can be built and run this way is discussed later, but for now let’s cover how to load one of the existing examples.

The ManagedSDKExample is a managed project, which means it’s written using the managed SDK and outputs a DLL and PDB file. An unmanaged SDK project will output a DLL, PDB, and MA file.

When built, these output files are stored in the Mdlapps folder within the OpenRoads Designer installation. This can be found under:

OpenRoads Designer CONNNECT Edition\OpenRoadsDesigner\Mdlapps

With the files in this location, the project can be found and loaded as a keyin. To do this, open the OpenRoads Designer CONNECT Edition application. Access the keyin menu under the Home tab:

Load the project using the mdl load keyin, passing in the name of the project as the argument. The command to load the ManagedSDKExample project is as follows:

mdl load ManagedSDKExample

If successful, the message “MANAGEDSDKEXAMPLE loaded.” will appear at the bottom of the application in the status bar. The keyin is now loaded and ready for use with the MANAGEDSDKEXAMPLE command. Any further commands specified within the keyin can be run from this root command (this command hierarchy will be explained later).