2.3.2. Creating the CADIBroker

After opening the library, the next step in establishing a target connection is calling CreateCADIBroker() as shown in Figure 2.3. This call instantiates a new broker and returns a pointer to it.

If the library implements the broker as a singleton object, CreateCADIBroker() returns a pointer to the singleton object.

Figure 2.3. Creating a CADIBroker

To view this graphic, your browser must support the SVG format. Either install a browser with native support, or install an appropriate plugin such as Adobe SVG Viewer.


The ObtainInterface() method from the returned broker must be called to verify compatibility with the caller. The obtained CAInterface pointer must be converted back to a CADIBroker pointer using a static_cast as shown in Example 2.2:

Example 2.2. Creating a CADIBroker

//get "CreateCADIBroker" symbol from dynamic library "dll"
void* entry = lookup_symbol(dll, "CreateCADIBroker");
CADIBroker* cadi_broker =
            ((*eslapi::CreateCADIBroker_t)entry)();
//compatibility check
CAInterface* ca_interface;
if_name_t ifName = "eslapi.CADIBroker2";
if_rev_t minRev = 0;
if_rev_t actualRev = 0;
ca_interface = cadi_broker->ObtainInterface(ifName,
                                            minRev,
                                            &actualRev);
if (ca_interface == NULL)
{
   //something went wrong, handle it...
}
else
{
   cadi_broker = static_cast<CADIBroker*>(ca_interface);
}
      ...

For more information on the alternatives for connecting to a simulation, see:

Copyright © 2008-2014 ARM. All rights reserved.ARM DUI 0444M
Non-ConfidentialID051314