NAME
adapter_finalize
- deinitializes the adapter and releases resources.
SYNOPSIS
#include <game-carrier/server.h>
GC_ADAPTER_EVENT
void adapter_finalize(
GCT_INT adapter_id);
Parameters:
adapter_id
GCT_INT
Unique identifier of the adapter.
RETURN VALUE
None.
DESCRIPTION
The adapter_finalize
method serves as the final call for the adapter, invoked
by the gcs
prior to unloading. Its purpose is to handle the deinitialization
of the adapter and release all associated resources.
The adapter_id
parameter represents the unique identifier of the adapter.
This value is used to make the discovery of the adapter possible.
EXAMPLE
#include <game-carrier/server.h>
#include <stdlib.h>
#include <string.h>
struct core_api api;
int adapter_id = -1;
char * adapter_load_path;
GC_ADAPTER_EVENT
GCT_INT adapter_initialize(
GCT_INT id,
struct core_api * core_api,
GCT_CPTR load_path)
{
api = *core_api;
adapter_id = id;
adapter_load_path = strdup(load_path);
/* Here is good place to initialize/allocate global adapter's resources */
return 0;
}
GC_ADAPTER_EVENT
void adapter_finalize(GCT_INT id)
{
/* Here is good place to deinitialize/free lobal adapter's resources */
free(adapter_load_path);
}
SEE ALSO
adapter_initialize
, application_finalize