adapter_initialize - Must be the first call by gcs to initialize the adapter.


#include <game-carrier/server.h>

GCT_INT adapter_initialize(
    GCT_INT adapter_id,
    struct core_api * api,
    GCT_CPTR load_path);


  • adapter_id GCT_INT Unique identifier of the adapter.
  • api struct Pointer to the API structure with adapter methods.
  • load_path GCT_CPTR Value for the dir property in the config file.


Returns a value of 0 to indicate successful execution.

A non-zero value is returned in the case of an error, in which the loading of gcs will be halted.


The adapter_initialize function serves as the initial step for the adapter, being the first call made by the gcs before any other adapter methods. Its purpose is to initialize the adapter, and it returns a value of 0 to indicate successful initialization. However, if there is an error during initialization, the function returns a non-zero value, prompting the gcs to abort loading the adapter.

The adapter_id parameter represents the unique identifier of the adapter. This value is used to make the discovery of the adapter possible in future calls.

The api parameter is a pointer to a structure that holds the server API. Certain methods, such as logging, are available before initialization, while others will become accessible after the application initialization process.

The load_path parameter represents the value assigned to the dir field in the adapter’s configuration file. This value can be utilized by the adapter according to its requirements. It’s worth noting that some adapters may choose to ignore this value.


#include <game-carrier/server.h>

#include <stdlib.h>
#include <string.h>

struct core_api api;
int adapter_id = -1;
char * adapter_load_path;

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;

void adapter_finalize(GCT_INT id)
    /* Here is good place to deinitialize/free lobal adapter's resources */



adapter_finalize, application_initialize