Skip to content

Conversation

@M2-TE
Copy link

@M2-TE M2-TE commented Oct 24, 2025

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 VmaFree being 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 as inline, 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 inline and static, which I wanted to hear some thoughts about:

  • Templated functions: These will always be inlined, so adding inline is redundant, but might be nice as an indication of intent. Some of these are also marked as static however, which would only really make sense for template specializations (of which there aren't any, as far as I could tell).
  • static in 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 alongside VMA_IMPLEMENTATION should only be used in a single location in the project, so there won't be any ODR violations. The static keyword 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fails to build with clang 21 when used via C++ module

1 participant