volk
volk copied to clipboard
Add VOLK_NAMESPACE configuration to use C++ namespaces
In some cases the use of global vk* symbols is inconvenient, as it can conflict with vk* functions defined by the loader; generally speaking this should not be required, but some dynamic library cases are difficult to support cleanly.
This problem can be solved when C++ is available: by building volk.h/c as C++ and wrapping functions in volk namespace, which is automatically used, the compiler can still find the functions so no change in source code is necessary, but the global symbols get C++ mangling that never overlaps with vk*.
This is not designed as a main mode of operation, but it can be useful when the default setup doesn't fully work.
I can merge this if people find it useful.
Note: this would need to be rebased against https://github.com/zeux/volk/pull/225 (assuming anybody needs this) before merge, as that PR splits the extern "C" block into two.
This is a good idea, I observed using those globally defined extern functions triggers several linker errors with Clang/LLVM compilers on Windows. It is very weird and not being seen on GCC base toolchains.
If we can just wrap all of those extern symbols inside some Macro like VOLK_DEFINE_PROTYPES and only keep the function table part, then it is even better since it will work for C as well.
For the latter I think you’d need something like #154? Together with VOLK_NO_PROTOTYPES.