Is there any documentation on what level or variant of C++ that IL2CPP supports, or any plan on upgrading the IL2CPP compiler to support more modern C++ features? We’ve been experimenting with using .cpp files directly in the project as source code plug in as per
https://docs.unity3d.com/Manual/WindowsPlayerCPlusPlusSourceCodePluginsForIL2CPP.html
but have been running into language support issues - such as no support for the ‘auto’ keyword, with is a C++14 thing, and etc. A lot of the code we are trying to use requires C++14 at a min, and C++20 if possible.
Right now our workaround is to make a set of native dlls for each supported platform, which is a massive pain and requires additional steps to keep our developers in sync with each other (which they often don’t).
We don’t document the C++ version used to compile generated IL2CPP code. At the moment it is at least C++11, but on some compilers/platforms it can vary depending on which version of the compiler is installed (e.g. on Windows IL2CPP will pick the latest version of Visual Studio installed on the machine).
The C++ source code plugin feature is pretty rudimentary, and not designed to work with complex build flags, so I would recommend taking the native DLLs option if you need anything special.
Do you know what, if any, flags are being passed to the back-end compiler (msvc for example)? It just seems odd to me that if IL2CPP is using the installed compiler (which is what I guessed was going on), then that compiler should not be barfing on the ‘known supported version of C++’
Would suggest that the info you posted + any more insights are captured in the online docs I referenced above; it would go a long way to help guide developers into picking the right option going forwards and clear up confusion as to “why isn’t this working???!!!”
I know there are many build flags being passed to the C++ compiler, but I don’t know what they are off the top of my head. I also know that they change from release to release of Unity, so they are not things that you want to depend on for your code to compile.
Good point about the documentation - I’ll follow up with our docs team about clarify this on the page you linked to originally.