Hello. I use vma in a small custom engine with clang22 and c++ modules. I have encountered the following problem.
Allocator.cppm:
module;
#include <vma/vk_mem_alloc.h>
export module rhi:allocator;
// Only an interface here
Allocator.cpp:
module;
#define VMA_IMPLEMENTATION
#include <vma/vk_mem_alloc.h>
module rhi;
// An implementation here
Causes
.../1.4.328.1/x86_64/include/vma/vk_mem_alloc.h:4222:9: error: no matching function for call to 'VmaFree'
4222 | VmaFree(pAllocationCallbacks, ptr);
| ^~~~~~~
.../1.4.328.1/x86_64/include/vma/vk_mem_alloc.h:4257:9: note: in instantiation of function template specialization 'vma_delete_array<char>' requested here
4257 | vma_delete_array(allocs, str, len + 1);
| ^
.../1.4.328.1/x86_64/include/vma/vk_mem_alloc.h:4479:20: error: no matching function for call to 'VmaFree'
4479 | ~VmaVector() { VmaFree(m_Allocator.m_pCallbacks, m_pArray); }
| ^~~~~~~
.../1.4.328.1/x86_64/include/vma/vk_mem_alloc.h:5695:14: note: in instantiation of member function 'VmaVector<char, VmaStlAllocator<char>>::~VmaVector' requested here
5695 | explicit VmaStringBuilder(const VkAllocationCallbacks* allocationCallbacks) : m_Data(VmaStlAllocator<char>(allocationCallbacks)) {}
| ^
.../1.4.328.1/x86_64/include/vma/vk_mem_alloc.h:4609:9: error: no matching function for call to 'VmaFree'
4609 | VmaFree(m_Allocator.m_pCallbacks, m_pArray);
| ^~~~~~~
.../1.4.328.1/x86_64/include/vma/vk_mem_alloc.h:5720:16: note: in instantiation of member function 'VmaVector<char, VmaStlAllocator<char>>::resize' requested here
5720 | m_Data.resize(oldCount + strLen);
| ^
.../1.4.328.1/x86_64/include/vma/vk_mem_alloc.h:4479:20: error: no matching function for call to 'VmaFree'
4479 | ~VmaVector() { VmaFree(m_Allocator.m_pCallbacks, m_pArray); }
...
fdelayed-template-parsing works around the problem, but it doesn't seem like a good solution.
What do you think?
Best regards!
Denis.
Hello. I use vma in a small custom engine with clang22 and c++ modules. I have encountered the following problem.
Allocator.cppm:
Allocator.cpp:
Causes
fdelayed-template-parsingworks around the problem, but it doesn't seem like a good solution.What do you think?
Best regards!
Denis.