Using shared libraries

HCL OneTest Embedded provides support for using, testing and profiling shared libraries with any C or C++ test or application node.

Shared libraries must be stored inside library nodes within the project in order for them to be accessed by test or application nodes. The library node is a container for the source files of the shared library.

Once the library has been included in the project, you must create link the library to the test or application by creating a reference node in the test or application node.

There are three steps that you must follow in order to use a shared library in your project:

  • Create a library node in the project.

  • Specify how the library is to be linked (statically or dynamically).

  • Create a reference to the library in the test or application node.

To add a shared library to your project:

  1. Right-click a group or project node and select Add Child and Library from the pop-up menu.
  2. Enter the name of the Library node
  3. Right-click the Library node and select Add Child and Files from the popup menu.
  4. Select the source files of the shared library and clickOK.

To specify link settings for a library node:

  1. Select a library node in the Project Explorer pane.
  2. In the Project Explorer, click the Settings button.
  3. Select the Build > Linker page and select the Generation Format:
    • Static library (.lib, .a)

    • Dynamic library (.dll, .so)

    • Executable file (.exe)

  4. When you have finished, click OK to validate the changes.

To link a library node to a test or application node:

  1. Right-click the test or application node that will use the shared library and select Add Child and Reference from the pop-up menu.
  2. Select the library that you want to reference and click OK.

Example

An example demonstrating how to test and profile shared libraries is provided in the Shared Library example project. See Example projects for more information.

Related Topics

Profiling shared libraries | Testing shared libraries