Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building VulkanMemoryAllocator for C #415

Open
XavierCS-dev opened this issue Apr 30, 2024 · 2 comments
Open

Building VulkanMemoryAllocator for C #415

XavierCS-dev opened this issue Apr 30, 2024 · 2 comments
Labels
question Further information is requested

Comments

@XavierCS-dev
Copy link

I would like to build this library to use with pure C. The build instructions in the repo seem to be for C++ however. I was wondering how this library could be built to be used with C?

Sorry this is not an actual issue with the library but the wiki does say I can ask questions by creating an issue.

@adam-sawicki-a
Copy link
Contributor

The library is written in C++, so it doesn't work with a project that only uses a compiler for pure C. The API (header) of the library is compatible with C, as it uses only global functions, structs, enums, etc., no classes. It means you can use the library in a C code. However, the internal implementation of VMA uses classes and other features up to C++14, so you need a modern C++ compiler to build the library. You can decide to make it part of your project source code or to compile it as a separate library, which will then have a C-compatible interface.

@adam-sawicki-a adam-sawicki-a added the question Further information is requested label May 6, 2024
@XavierCS-dev
Copy link
Author

The library is written in C++, so it doesn't work with a project that only uses a compiler for pure C. The API (header) of the library is compatible with C, as it uses only global functions, structs, enums, etc., no classes. It means you can use the library in a C code. However, the internal implementation of VMA uses classes and other features up to C++14, so you need a modern C++ compiler to build the library. You can decide to make it part of your project source code or to compile it as a separate library, which will then have a C-compatible interface.

Thanks! I managed to compile it for C++ then link the static library with my C code. However I decided to switch to C++ anyway due to the better ecosystem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants