Skip to content

Getting started

Finalspace edited this page May 29, 2026 · 2 revisions

Table of Contents

Download & Setup

Download

  • You download the latest "final_platform_layer.h" file.
  • Drop it into your C/C++ project and use it in any place you want.

Setup?

  • No setup required

Requirements

FPL uses built-in operating system libraries and requires a C99 or C++11 compliant compiler.

Depending on the compiler and platform - linking to one system library may be needed:

Win32

  • Link against "kernel32.lib"

Unix/Linux

C-Runtime optional

By default, FPL uses the CRT (C-Runtime-Library) for functions such as vsnprintf(), but its usage is optional.

To learn how to use FPL without the CRT, see the page How to disable the use of the CRT in FPL

How to use FPL?

In your main C/C++ translation-unit include the header file and call fplPlatformInit() and fplPlatformRelease() respectively:

#define FPL_IMPLEMENTATION
#include "final_platform_layer.h"

int main(int argc, char **argv) {
    // Initialize the platform with default settings
    if ((, )) {

        // your code goes here

        // Release the platform
        ();
        return 0;
    } else {
        return -1;
    }
}

You can then include this file in any other C/C++ source or header file as you would with any other header file.

Provide the typical main entry point with at least the initialization and release of the platform:

How to use FPL in multiple translation units?

To use FPL in multiple translation units, it is recommended to create a separate "final_platform_layer.c" file in the same directory FPL is located and define the implementation there only.

Note: It is very important that the features you define in the translation units matches the header inclusion! For example using

FPL_NO_VIDEO in one place, but not in the others will propably result in compile errors.

final_platform_layer.c:

#define FPL_IMPLEMENTATION
#define FPL_NO_ENTRYPOINT // Disable the entry point inclusion
#include "final_platform_layer.h"

This way FPL implementation is compiled once and can be used everywhere.

In your main translation-unit, you just include the entry point only using the preprocessor define FPL_ENTRYPOINT.

main.c:

#define FPL_ENTRYPOINT // Integrate entrypoint only
#include "final_platform_layer.h"

How to use FPL in a static library?

To use FPL as a/in static library you do the same steps required for using FPL in multiple translation units.

See How to use FPL in multiple translation units? for more details.

How do I get the code-documentation to show up in the IDE?

When FPL is compiled directly in your main translation-unit, some IDEs read the comments from the implementation bodies instead of from the header definitions.

This is wrong, but we can't help it. Those editors just aren't designed for single-header-file libraries :-(

But do not fear, you can get the comments to show up in your IDE properly, just compile the implementation into a separated translation-unit only.

This way the IDE will parse the comments from the API declaration only. See How to use FPL in multiple translation units? for more details.

Options

See Compiler Options for all compile-time options.

Final Platform Layer

Pages

Topics

Data Structures

Clone this wiki locally