Skip to content

C++20 module support #1317

@Gaspard--

Description

@Gaspard--

Describe the problem you are trying to solve.

flecs.h isn't small, and can slow down compilation of a file about 1-2 seconds on my machine.
This can add up over multiple files.
C++ modules allow to reduce this by only exposing relevant symbols and pre-compiling the module so that it can be reused.
I tried wrapping flecs.h into a module manually, but it seems due to how new is used within the library this does not work.
Maybe I'm missing something though.

Describe the solution you'd like

Add C++20 module support directly into flecs, allowing something like import flecs;.

From what I checked in flux, C++ module support boils down to adding a define (something like FLECS_EXPORT) which expands to export or nothing depending on another define.
Then, a module file is provided by the library which exports a module, enables this define and then includes the header to export the symbols.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions