Skip to content

modest proposal for enhanced multi-platform support #130

@jonforums

Description

@jonforums

It's likely that platform specific implementation details will become scattered throughout the codebase making it less maintainable and less understandable.

I propose a change to the current include structure to better modularize platform specifics where possible. Specifically, update mruby.h with the following


...
#ifndef MRUBY_H
#define MRUBY_H

#include 
#include "mrbconf.h"

#if defined(__unix__) || defined(__POSIX__) || defined(__APPLE__)
# /* TODO: include "mrb-internal/mrb-unix.h" */
#else
# include "mrb-internal/mrb-win.h"
#endif

and start by consolidating all the applicable windows impl oddities into the include/mrb-internal/mrb-win.h file. The goal is to minimize platform specific #ifdef's in the *.c files and allow for future platform specific include files, eg. mrb-internal/mrb-arm.h.

An example of how this looks in real-world code:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions