Files
Toy/source/toy_common.h
Kayne Ruse a28053d4e9 Reworked Toy_String as a union, enabled -Wpedantic
Toy now fits into the C spec.

Fixed #158

Addendum: MacOS test caught an error:

error: a function declaration without a prototype is deprecated in all versions of C

That took 3 attempts to fix correctly.

Addendum: 'No new line at the end of file' are you shitting me?
2024-12-15 15:52:06 +11:00

59 lines
1.3 KiB
C

#pragma once
//for specified type sizes
#include <stdbool.h>
#include <stdint.h>
#include <stddef.h>
//TOY_API is platform-dependant, and marks publicly usable API functions
#if defined(__linux__)
#define TOY_API extern
#elif defined(_WIN32) || defined(_WIN64)
#if defined(TOY_EXPORT)
#define TOY_API __declspec(dllexport)
#elif defined(TOY_IMPORT)
#define TOY_API __declspec(dllimport)
#else
#define TOY_API extern
#endif
#elif defined(__APPLE__)
#define TOY_API extern
#else
//generic solution
#define TOY_API extern
#endif
//TOY_BITNESS is used to encourage memory-cache friendliness
#if defined(__linux__)
#if defined(__LP64__)
#define TOY_BITNESS 64
#else
#define TOY_BITNESS 32
#endif
#elif defined(_WIN32) || defined(_WIN64)
#if defined(_WIN64)
#define TOY_BITNESS 64
#else
#define TOY_BITNESS 32
#endif
#elif defined(__APPLE__)
#if defined(__LP64__)
#define TOY_BITNESS 64
#else
#define TOY_BITNESS 32
#endif
#else
//generic solution
#define TOY_BITNESS -1
#endif
//bytecode version specifiers, embedded as the header
#define TOY_VERSION_MAJOR 2
#define TOY_VERSION_MINOR 0
#define TOY_VERSION_PATCH 0
//defined as a function, for technical reasons
#define TOY_VERSION_BUILD Toy_private_version_build()
TOY_API const char* Toy_private_version_build(void);