Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce a platform abstraction layer #17

Open
andreabedini opened this issue Feb 18, 2025 · 0 comments
Open

Introduce a platform abstraction layer #17

andreabedini opened this issue Feb 18, 2025 · 0 comments

Comments

@andreabedini
Copy link
Member

Different architectures are supported by having #if defined scattered around the codebase. Introducing a minimal platform abstraction API will simplify the code and lower its maintainance cost. E.g. turning

#if defined(mingw32_HOST_OS)
someWindowsFunction();
#else
someUnixFunction();
#endif

into

platformSpecificFunction();

Where platformSpecificFunction is implemented in a separate file that can included only when relevant. Implementing the same API will also make sure all supported architectures provide the same features.

This is rough sketch of platform-dependent APIs:

Function Category Needed API Functions
Thread Management platform_create_thread(), platform_join_thread()
Process Management platform_fork_exec(), platform_terminate_process()
Floating-Point Handling platform_init_fpu()
File System Paths platform_normalize_path(), platform_get_temp_dir()
Library Loading platform_load_library(), platform_get_symbol()
Console Handling platform_set_console_mode(), platform_get_console_size()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant