Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
!! Not ready for merging yet.
I'd like to put forward a proposal to provide support for MSVC native builds on more modern versions of windows.
Providing more seamless support for MSVC should greatly improve the adoption story for the library, and make it easier to use from other languages (nim, rust, zig etc..) as it reduces the need for a cross compiling environment. Several issues have pointed this out such as #255
I Intend to provide a msvc compatible build leveraging cmake as the build generator. I've started some initial work on a PR here. as a proof of concept.
On windows you can now just
And build through visual studio. (tested so far with vs 2022) No further dependencies are needed to use the WASAPI. It seems there has been some MSVC Support already from looking through the CMakeLists.txt.
Three issues need to be addressed in order to provide this support, and I'd like to hear thoughts.
1. an implementation of stdatomic.h not possible.
To remedy the lack of stdatomic.h I propose to leverage MSVC compiler intrinsics to implement the functions needed by the library and its' tests. this does result in an change in the
atomics.h
api. allSOUNDIO_ATOMIC_XXX
functions now need to reference the target type of atomic they are operating on.This is similar to the approach used by https://github.com/mintomic/mintomic (and its' replacement; turf) to achieve cross platform atomic implementation in C.
2. unistd.h is not available on msvc platforms
to this end unistd wont be used on the MSVC builds the only thing that was needed was
sleep
this is easily replaced by thewindows.h
'sSleep
function.3. Passing all warnings in MSVC
This one sounds like a nice to have, and I'm still working on it.
But for a lot of warnings especially regarding Windows' static analyzer we may not be able to get all of them. In particular, ones where microsoft reaaly want you to decorate pointers with compiler specific attributes.
Some warnings I'm trying to fix pedantically:
Continuing on.
Let me know if this is a good direction for the library and I should commit to testing this far more rigorously, or if this should stay in a seperate fork.