A.2.2. Creating the CADIBroker

Example A.3 shows the prototypes for the functions that create the CADIBroker. This is the first step in creating a new simulation or connecting to an existing one.

Example A.3. Creating the CADIBroker

extern "C"
// Global function exported by a dynamically loaded object.
// This function must exist in a dynamically loaded object(DLL/.so).
// It allows the client to instantiate the CADIBroker.
CADI_WEXP eslapi::CADIBroker * CreateCADIBroker();

The prototype declaration listed in Example A.4 enables a global function to instantiate a broker from a dynamically loaded object.

Example A.4. CADIBroker type declaration

typedef CADIBroker * (CreateCADIBroker_t)();

Clients must locate this symbol and cast it as a pointer to CreateCADIBroker_t:

// CreateCADIBroker_t
void * entry = lookup_symbol(dll, "CreateCADIBroker");
CADIBroker *broker = ((*CADIBroker::CreateCADIBroker_t)entry)();
Copyright © 2008-2010 ARM Limited. All rights reserved.ARM DUI 0444F