Final Platform Layer  0.9.6-beta
Getting started

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

  • Link against "libld.so"

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 more details, see the page How to disable the use of the CRT in FPL

How to use FPL?

In one of your C/C++ translation-unit include this:

#define FPL_IMPLEMENTATION
#include "final_platform_layer.h"

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:

int main(int argc, char **argv) {
// Initialize the platform
// your code goes here
// Release the platform
return 0;
} else {
return -1;
}
}

How to use FPL in multiple translation units?

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

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_translation_unit.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 IDE's 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 are not 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.

fplPlatformRelease
fpl_common_api void fplPlatformRelease()
Releases the resources allocated by the platform layer.
fplInitFlags_All
All init flags.
Definition: final_platform_layer.h:3390
fplPlatformInit
fpl_common_api bool fplPlatformInit(const fplInitFlags initFlags, const fplSettings *initSettings)
Initializes the platform layer.
fpl_null
#define fpl_null
Null.
Definition: final_platform_layer.h:2166