8000 Consider supporting C++20 modules · Issue #104 · brofield/simpleini · GitHub
[go: up one dir, main page]

Skip to content

Consider supporting C++20 modules #104

Open

Description

@crueter

The time has come.

Realistically, there are two paths:

  • Provide a module interface that just includes and exports the entire header file
    • This is fragile but apparently works totally fine on newer compilers.
  • Provide a module interface that includes the header file, then selectively exports what it needs
    • This is more "correct" but also a very difficult task.

The nuclear option would be to bump the minimum to C++20 and switch to using pure modules. I can already feel the angry looks from the boomers. I would not recommend this unless you have a death wish, or if the entire world decides to switch to modules overnight.

This would be a huge help for my projects that use this, as I am trying to push modules as far forward as possible.

Activity

  1. brofield commented on Nov 18, 2026

    @brofield
    Owner

    Not going to bump to min c++20, nor switch to a modules only interface. This isn't about "boomers", it is about backward compat and supporting projects that have decades of history using this project.

    Creating a new module interface based on importing the existing header seems possible. I'm thinking something like the following, with different modules for the different converters, generic/win32/icu.

    Since this matters to you, why don't you put this together in consumer code, and tell me how it works out for you. Let me know what issues you have, and then create a PR with any suggested changes needed (that still provide backward compat).

    module;
    
    #define SI_SUPPORT_IOSTREAMS
    #define SI_CONVERT_GENERIC
    #include <algorithm>
    #include <cerrno>
    #include <cstdlib>
    #include <cstring>
    #include <limits>
    #include <list>
    #include <map>
    #include <stdio.h>
    #include <string>
    #include <iostream>
    #include <wchar.h>
    
    export module simpleini;
    
    #include "SimpleIni.h"
    export using ::CSimpleIniTempl;
    export using ::CSimpleIniA;
    export using ::CSimpleIniCaseA;
    export using ::CSimpleIniW;
    export using ::CSimpleIniCaseW;
    export using ::SI_Error;
    export using ::SI_OK;
    export using ::SI_UPDATED;
    export using ::SI_INSERTED;
    export using ::SI_FAIL;
    export using ::SI_NOMEM;
    export using ::SI_FILE;
    export using ::SI_MAX_FILE_SIZE;
    
    #undef CSimpleIni
    #undef CSimpleIniCase
    
    export using CSimpleIni = CSimpleIniA;
    export using CSimpleIniCase = CSimpleIniCaseA;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0