## Debugging a DLL Project Tutorial

In this example we show how to create a project for a DLL (Dynamic Linked Library) using one of the built-in Carbide templates, how to build it into an executable, and how to launch the debugger to verify program accuracy. The steps to do this include:

1. Creating a DLL project from a project template
2. Building the DLL object code based on the project sources
3. Debugging the DLL using the Carbide debugger

With the DLL compiled into object code, it's time to link it to any process running on the target device, then launch it with the debugger. Using the New Launch Configuration Wizard makes doing this quick, easy, and reliable.

Debugging a DLL project

1. Select the project to launch in the Project Explorer view.
2. Launch a debug session using one of these actions:
   - Right-click the project in the Project Explorer view and choose Debug As > Debug on Emulator or Device menu option.
   - Click the Run > Debug (F11) menu option.
   - Click the Debug () icon in the toolbar to build the project.

   The first time you perform any of the following actions, the New Launch Configuration Wizard appears asking for the additional info to connect to a device.

3. Provide the wizard the information it needs to complete the Configure launch configuration.

   Complete all of the options below to create a launch connection for the DLL project.

   1. Connect to device — click Change... to select a Current connection, create a new one, or edit the chosen remote connection settings.

   2. Debug process — click Change... to open the Change Debug Process dialog. Then select the Attach to process option and click OK

      To debug a DLL you simply need to attach it to any process running on the target device. Setting the Attach to process option will throw up a Attach to Process dialog when you start a debug session.

   3. Other Settings — click Change... to open the Other Settings dialog to set a preference for when the project is built during a launch, then click OK.

   4. (Optional) Edit advanced settings before launch — enable this option and click Edit to open the Debug Configurations dialog where you can set more launch options. Click Close to cancel the debug session launch.

   The Debug control enables when all the information is complete.

4. Click Debug.

   The debug session is launched and the Attach to Process dialog appears. Select a process and click OK to continue.

The DLL is attached to the running process and control returns to the Carbide debugger. From this point you can use all of the Carbide debugger features to debug the DLL as it runs on the device.

#### Other references

- DLL Projects