Skip to content

Conversation

@zeux
Copy link
Owner

@zeux zeux commented Feb 3, 2025

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.

@zeux
Copy link
Owner Author

zeux commented Feb 3, 2025

I can merge this if people find it useful.

@zeux
Copy link
Owner Author

zeux commented Feb 16, 2025

Note: this would need to be rebased against #225 (assuming anybody needs this) before merge, as that PR splits the extern "C" block into two.

@felixaszx
Copy link

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.

@zeux
Copy link
Owner Author

zeux commented Jul 27, 2025

For the latter I think you’d need something like #154? Together with VOLK_NO_PROTOTYPES.

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.
@zeux zeux merged commit 6bb0835 into master Sep 8, 2025
6 checks passed
@zeux zeux deleted the namespace branch September 8, 2025 17:32
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.

2 participants