Skip to content

Single-header file C libraries for wrapping OS-specific functionality. Compatible with C++.

License

Notifications You must be signed in to change notification settings

NeRdTheNed/OSWrapper

Repository files navigation

OSWrapper

Single-header file libraries to wrap OS-specific functionality.

Build

Library Description Platform implementations
oswrapper_image.h Image decoder using OS libraries macOS, Windows (Vista and higher), Emscripten
oswrapper_audio.h Audio decoder using OS libraries macOS (10.4 and higher), Windows (7 and higher)
oswrapper_audio_enc.h Audio encoder using OS libraries macOS (10.4 and higher), Windows (7 and higher)

Usage

These libraries are single-header file libraries. Include them in exactly one C or C++ file as such:

#define OSWRAPPER_LIBRARYNAME_IMPLEMENTATION
#include "oswrapper_libraryname.h"

Replace libraryname with the name of the library.

Unlike standard single-header file libraries, you'll generally need to link against a system library to use these libraries, or perform some platform-specific initialisation action before using them. Here's the requirements:

Library macOS Windows Emscripten
oswrapper_image.h Link with -framework AppKit Initialise the COM library, link with windowscodecs.lib Compile with Asyncify
oswrapper_audio.h Link with -framework AudioToolbox Initialise the COM library, link with mfplat.lib, mfreadwrite.lib, and shlwapi.lib N/A
oswrapper_audio_enc.h Link with -framework AudioToolbox Initialise the COM library, link with mf.lib, mfplat.lib, mfreadwrite.lib, and shlwapi.lib N/A

Full examples of linking and using OSWrapper libraries can be found in the test folder.

Future work

  • Emscripten audio decoding
  • Haiku support
  • SerenityOS support

Issues and PRs are welcome.

License

All OSWrapper libraries and test / demo applications are licensed under the BSD Zero Clause License.