I want to add a c++ ecs library in my project(https://github.com/skypjack/entt). But this library need c++17 or c++14.
Now i use c++11 and it work in all platforms.
If i use c++17 will it work on all platforms? Or maybe i need to use another library?
Clang 6.0 - iOS, OSX, Windows
GCC 5.4 - Linux
GCC 4.8 - Android
Emscripten 1.38.12 - HTML5
(edit: forgot the SDKs)
Windows - MSVC 2015
iOS 11.2
OSX - 10.13
Android - NDK 10e, Api Level 14, , BuildTools23.0.2, API
This is important to know, since that affects the ABI of the libraries.
We don’t currently specify any “-std=c++xx” flag ourselves, we rely on the default version of the compiler.
In the engine, we use no C+±xx features at all, And no STL. We’re mostly C.
This helps you add your own librares to it, since it lessens the risk of ABI version clashes.
But, a reminder, that if you write very C+±y extensions, with the latest fancy C++ version, others might not be able to use it, because they get ABI clashes.
Technically, GCC is mostly ABI-compatible between compiler versions and -std versions. From what I remember reading, C++11 introduced some ABI-incompatible changes, but libstdc++ is compatible with both the old ABI and the new ABI, so you shouldn’t get linker errors. The bigger issue is Android, where you can choose to link against a bunch of different stdc++ libs, which will definitely trigger linker errors if two native extensions require different standard libraries, for example.
I’m not sure providing a static C library wrapping the C++ behaviour might do the trick. The symbols are resolved at link time and an .a file is still just a collection of unlinked object files. A dynamic library exposing a C API should do the trick, though.