CX Framework
Cross-platform C utility framework
Loading...
Searching...
No Matches
Platform Abstraction

Modules

 Base Platform Definitions
 
 CPU Operations
 
 OS Services
 

Detailed Description

The platform abstraction layer provides cross-platform APIs and compiler/OS detection. It isolates platform-specific code behind a consistent interface, supporting:

The abstraction is organized into three main areas:

Platform-specific code is selected at compile time using preprocessor conditionals. Applications should include this header and use the portable APIs rather than directly using platform-specific functions.

Example usage:

// OS services
int cpus = osPhysicalCPUs();
osSleep(1000000); // Sleep for 1ms (time in microseconds)
// Atomic operations
atomic(int32) counter = 0;
atomicFetchAdd(&counter, 1, AcqRel);
// Random data
uint8 buffer[32];
osGenRandom(buffer, sizeof(buffer));
bool osGenRandom(uint8 *buffer, uint32 size)
int osPhysicalCPUs()
void osSleep(int64 time)