7.3.1.2
RuntimeApiEntry_DestroyInterface
Beschreibung
Nutzen Sie die Funktion RuntimeApiEntry_DestroyInterface nur, wenn die
API-Bibliothek (DLL) von einem anderen Verzeichnis geladen werden soll als dem
Startup-Verzeichnis der Anwendung, die diese Funktion aufruft.
Wenn die API über die Funktion InitializeApi initialisiert wurde, dann wählen Sie die
Funktion DestroyInterface() (Seite 106).
Die Funktion entlädt den Speicher einer ISimulationRuntimeManager,
IRemoteRuntimeManager oder IInstance Schnittstelle.
Tabelle 7- 23 RuntimeApiEntry_DestroyInterface() - Native C++
Syntax
Parameter
Rückgabewerte
Beispiel C++
S7-PLCSIM Advanced
Funktionshandbuch, 05/2021, A5E37039506-AD
__declspec(dllexport) ERuntimeErrorCode RuntimeA-
piEntry_DestroyInterface(
IBaseInterface* in_Interface
);
•
IBaseInterface* in_Interface:
Die Schnittstelle, die gelöscht werden soll.
Runtime Fehlercode
SREC_OK
SREC_WRONG_ARGUMENT
// Include The Headerfile Of The API
#include "SimulationRuntimeApi.h"
// Prepare The Variables
ERuntimeErrorCode result = SREC_INVALID_ERROR_CODE;
HMODULE dllHandle = NULL;
ApiEntry_DestroyInterface Destroy = NULL;
IInstance* instance = NULL;
// Load The DLL And Import The "DestroyInterface" Function
(using the Win32 API)
dllHandle = LoadLibraryA(DAPI_DLL_NAME_X86);
if ( dllHandle != NULL )
{
Destroy = (ApiEntry_ DestroyInter-
face)GetProcAddress(dllHandle,
DAPI_ENTRY_DESTROY_INTERFACE);
}
...
// Frees the memory of an IInstance interface
result = Destroy(instance);
Anwenderschnittstellen (API)
7.3 API herunterfahren
Bedingung
Die Funktion ist erfolgreich.
Der Zeiger auf die Schnittstelle ist NULL.
107