2.3.2 Creating the CADIBroker

After opening the library, the next step in establishing a target connection is calling CreateCADIBroker(). 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.

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);
}
      ...          

Note:

Unless otherwise specified, the instructions apply to either:
  • Connecting to an existing simulation.
  • Instantiating a new simulation.

Alternatives for connecting to a simulation are:

  • Get the simulation factories owned by the broker.
  • Get the currently running simulations.
Non-ConfidentialPDF file icon PDF version100963_0200_03_en
Copyright © 2014–2018 Arm Limited or its affiliates. All rights reserved.