Platform Layer

Platform support, POSIX-only subsystems, platform guards, and portability rules.

Platform Support Overview

PlatformStatusNotes
LinuxFullPrimary development platform. All tests pass.
macOSFullPOSIX-compatible. Same as Linux.
WindowsPartialThe Net component links ws2_32 privately. POSIX-only subsystems remain known gaps.
AndroidPartialThe Storage component uses SDL3 when selected; SDL3 must be provided by the parent project first.
EmscriptenPartialCompiles cleanly. Some features throw PlatformNotSupportedException at runtime.

POSIX-Only Subsystems

These subsystems currently use POSIX-specific APIs and are documented as known bugs, not completed features:

SubsystemPOSIX API UsedStatus
System::Net::Sockets<sys/socket.h>, <unistd.h>POSIX-only
System::IO::RandomAccesspread, pwrite, fsyncDone (has Win32 fallback)
System::AppDomain / AppContext/proc/self/exeLinux-only
System::TimeZoneInfolocaltime_r, /usr/share/zoneinfoPOSIX-only

Platform Guard Rules

These rules are enforced project-wide (see CLAUDE.md):

Example Guard Pattern

// In a .cpp file — platform-specific implementation
#ifdef _WIN32
    #include <windows.h>
    // Win32 implementation
#elif defined(__EMSCRIPTEN__)
    throw System::PlatformNotSupportedException("Not available on Emscripten.");
#else
    #include <unistd.h>
    // POSIX implementation
#endif

Windows-Specific

The Net component automatically links ws2_32 privately on Windows. Consumers request SharpRuntime::Net or a higher-level networking component and do not link ws2_32 themselves.

Android-Specific

On Android, SharpRuntime::Storage::StoragePaths uses SDL3 APIs to determine storage paths:

SDL3 headers and library must be available via the parent project before add_subdirectory(sharp-runtime) is called when Storage is selected. The component accepts either SDL3::SDL3 or SDL3::SDL3-static.

Emscripten-Specific

Emscripten (WebAssembly) support requires:

StoragePaths

modules/storage/include/SharpRuntime/Storage/StoragePaths.hpp | modules/storage/src/SharpRuntime/Storage/StoragePaths.cpp

Provides platform-aware isolated storage paths:

std::filesystem::path root = SharpRuntime::Storage::StoragePaths::GetIsolatedStorageRoot();

Implementation varies by platform: uses SDL_GetPrefPath on Android, appropriate paths on other platforms.

Network Sockets

modules/net-sockets/include/System/Net/Sockets/

Status: POSIX-only

ClassHeader
TcpClientSystem/Net/Sockets/TcpClient.hpp
UdpClientSystem/Net/Sockets/UdpClient.hpp
NetworkStreamSystem/Net/Sockets/NetworkStream.hpp

These use <sys/socket.h> and related POSIX headers. Windows and Emscripten support is incomplete.