If no DLL is available, the function accesses the next directory.
The function returns an interface to the Simulation Runtime Manager. Use this interface to
create a new instance of the virtual controller or to obtain access to an existing instance.
Table 7- 18
Syntax
Parameters
Return values
Example C++
Note
If you no longer require the interface, delete it.
See DestroyInterface() (Page 101).
S7-PLCSIM Advanced
Function Manual, 12/2017, A5E37039512-AB
InitializeApi() - Native C++
ERuntimeErrorCode InitializeApi(
ISimulationRuntimeManager** out_SimulationRuntimeManagerInterface
);
ERuntimeErrorCode InitializeApi(
WCHAR* in_SimulationRuntimeApiDllPath,
ISimulationRuntimeManager** in-
out_SimulationRuntimeManagerInterface
);
•
ISimulationRuntimeManager**
out_SimulationRuntimeManagerInterface:
Pointer to a Runtime Manager interface pointer. The pointer must be initial-
ized with
. The interface is created within the function. See Data types
NULL
(Page 279).
•
WCHAR* in_SimulationRuntimeApiDllPath
The path to the Runtime API library.
Runtime error code
SREC_OK
SREC_WRONG_ARGUMENT
SREC_WRONG_VERSION
SREC_CONNECTION_ERROR
SREC_ERROR_LOADING_DLL
SREC_RUNTIME_NOT_AVAILABLE
// Include The Headerfile Of The API
#include "SimulationRuntimeApi.h"
// Prepare The Variables
ERuntimeErrorCode result = SREC_INVALID_ERROR_CODE;
ISimulationRuntimeManager* api = NULL;
// Initialize The API And Get The RuntimeManager Interface
InitializeApi
result =
Condition
The function is successful.
The pointer to the Runtime Manager interface
does not equal
The required version of the interface is
•
incompatible with the version used to
compile the API.
The version of the API is not compatible
•
with Runtime.
See Compatibility during upgrade (Page 31).
Unable to establish a connection to the
Runtime Manager.
The API library cannot be loaded.
No Runtime Manager runs in this Windows
user session.
(&api);
User interfaces (API)
7.2 Initialize API
:
.
NULL
97