Trail C SDK
Trail C SDK

This is the Trail native SDK reference documentation, the libraries and headers are available for download in the game manager.

What's available in the package:

trail.h # Header file with the definition of all our functions and structs
trailsdk.bundle # Lib for developing on OSX
libtrailsdk.bc # Emscripten lib compiled with emcc 2.0.16 # Linux shared object
trailsdk.dll # Windows dll


#include <trail.h>
Trail* trail_sdk;
TrailDestroy trail_destroy;
const char* cloud_storage_path;
const char* username = "anon";
void sync_cloud_storage_cb(TrailResult res, void *data) {}
void init_cb(TrailResult res, Trail* sdk, TrailDestroy destroy, void* data) {
/* Try to verify the result of Trail's methods */
if (res != TRAIL_RESULT_OK) {
fprintf(stderr, "Error while initalising Trail SDK: %d\n", res);
trail_sdk = sdk;
/* This function should be call when you exit the game to terminate the sdk before */
trail_destroy = destroy;
/* Stop the loading spin and actually start the game */
/* Retrieve username of the player */
/* Retrieve the folder path where you can save your files */
char* file_path;
asprintf(&file_path, "%s/%s", cloud_storage_path, "my_save");
FILE *save = fopen(file_path, "w+");
fprintf(save,"level:%d", 7);
/* Sync your files in the cloud storage folder */
trail_sdk->file_kit->sync_cloud_storage(sync_cloud_storage_cb, NULL);
int main() {
/* Address of the runnnig CLI for developement, not needed for emscripten build */
char dev_host[] = "\0";
TrailInitParams params = {nullptr, 0};
strncpy((char*)params.dev_host, dev_host, sizeof(dev_host));
/* Init the sdk, this is a blocking call in non EMSCRIPTEN builds */
trail_init(&params, init_cb, NULL);
while (true) {
/* Your game */
/* [...] */
/* Terminate the trail SDK */
return 0;
TrailResult(* get_username)(const char **username)
Definition: trail.h:291
TrailResult(* report_game_loaded)()
Definition: trail.h:347
void(* sync_cloud_storage)(TrailBasicCB callback, void *callback_data)
Definition: trail.h:115
TrailResult(* get_cloud_storage_path)(const char **ptr)
Definition: trail.h:114
int32_t TrailResult
Definition: trail.h:41
Definition: trail.h:44
TrailFileKit * file_kit
Definition: trail.h:389
TrailCore * core
Definition: trail.h:382
TrailAuthKit * auth_kit
Definition: trail.h:383
const char dev_host[256]
Definition: trail.h:377
TRAIL_SDK_API TrailResult trail_init(TrailInitParams *params, TrailInitCB callback, void *callback_data)
Initialize the Trail SDK, the call is blocking on non EMSCRIPTEN build.
void(* TrailDestroy)(Trail *trail)
Definition: trail.h:395
Definition: trail.h:381
Definition: trail.h:375