Esa_Main()
Abstract
Performs low-level initialization and optionally starts the cosimulation code.
Syntax
Esa_Main (argc, argv, options)
| Argument | Type | Description |
|---|---|---|
argc |
int |
size of argv array |
argv |
char ** |
array of string arguments, typically as provided to main() entry point. |
options |
int |
one of: - ESAC_OPTS_NONE—no special options- ESAC_MAIN_OPTS_CALL—look for and invoke esa_main (see Details) |
Return Type
int
Cosim-defined value returned by esa_main(), if invoked, or 1 if esa_main() is not invoked.
Header
esa.h
Details
This function is a pre-initialization routine used to do immediate actions while leaving the bulk of the initialization to Esa_Init().
A Riverbed analysis software simulation can run in either “dynamic” mode (using op_runsim to load a repository) or “static” mode (using op_mksim to create an executable). The same applies to a cosimulation. In addition, we also have the relationship between the Riverbed analysis software and the cosimulation code. One provides the main() entry point and will thus somehow invoke the other.
Case 1—main() supplied by Riverbed Modeler
In this case, Esa_Main() is invoked with options set to ESAC_MAIN_OPTS_CALL. The cosimulation code should be linked in. A function named esa_main() is looked for and invoked after a set of low-level Riverbed Modeler initializations.
Case 2—main() supplied by cosimulation
In this case, the main() function should invoke Esa_Main() as early as possible. After the core ESA initializations are performed, one of two things happens:
- If
optionsis set toESAC_MAIN_OPTS_CALL, a function namedesa_main()is looked for and, if found, invoked.Esa_Main()will return only afteresa_main()returns. - If
optionsis set toESAC_OPTS_NONE,Esa_Main()returns immediately after the initialization is complete.
If an esa_main() routine is invoked, it should call Esa_Init(), Esa_Load(), and so on. If no esa_main() routine is invoked, the code that called Esa_Main() must then call Esa_Init(), Esa_Load(), and so on.