Marking VmaMalloc and VmaFree as static inline
#514
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This resolves #513.
Some background first:
When using C++20 modules, exporting VMA leads to issues with the newly released Clang 21. It e.g. complains about
VmaFreebeing an unkown symbol, as it is a TU-local entity with internal linkage (static), which cannot be exported. The solution here is to also mark the function asinline, which allows the compiler to export this function as part of another function that can be exported.Looking through the rest of the code, there are a few redundant or contradictory uses of
inlineandstatic, which I wanted to hear some thoughts about:inlineis redundant, but might be nice as an indication of intent. Some of these are also marked asstatichowever, which would only really make sense for template specializations (of which there aren't any, as far as I could tell).staticin general: This library is intended to be used in both C and C++ environments, correct? I only have experience with the latter, so correct me if it is wrong for either, but do static functions even make sense here (inside the implementation portion)? The header alongsideVMA_IMPLEMENTATIONshould only be used in a single location in the project, so there won't be any ODR violations. Thestatickeyword for this purpose was supposed to be deprecated in C++11 in favor of using anonymous namespaces instead. Since the implementation side is C++, that might be a better solution, if this functionality is even desired.