Closed LeStahL closed 1 year ago
In cwav.c, I'm getting some build errors with the Microsoft compiler; at least the packing could be done with #pragma pack(push, 1)
and #pragma pack(pop)
which should work with both Microsoft and GCC too.
Also: cwav.c(38): error C2099: initializer is not a constant. I'm not sure what's up with that, looks pretty constant to me.
Ah, I tested windows with mingw - yeah, good suggestion with the pragma.
interestingly, the other problem is a C language problem - static or global aggregate initializer lists have to be compile-time constants, which the sizeof expression isn't. gcc allows this, MSVC insists on the standard here.
solution: I initialized the struct inside main, should work now.
Can you:
1) Add something like the following quick fix to the cplay.windows.directsound.c
, as the headers in MinGW don't include this definition:
#ifndef DSBCAPS_TRUEPLAYPOSITION // Not defined in MinGW dsound headers, so let's add it
#define DSBCAPS_TRUEPLAYPOSITION 0x00080000
#endif
This allows fixes compiling the directsound thingy with Mingw on windows.
2) Add following quick fix to examples\code\C\CMakeLists.txt
:
# this fixes a bug in creating a static library from asm, similar to
# https://discourse.cmake.org/t/building-lib-file-from-asm-cmake-bug/1959
# but for NASM
if (MSVC)
set(CMAKE_ASM_NASM_CREATE_STATIC_LIBRARY "<CMAKE_AR> /OUT:<TARGET> <LINK_FLAGS> <OBJECTS>")
endif()
3) In examples\code\asm\CMakeLists.txt
, tell MinGW to not link CRT i.e.
if(WIN32)
set(abi win)
set(libraries ${windows_libraries})
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(link_options -nostartfiles)
endif()
....
4) Squash all the fixes into one & force push; I'll rebase and merge to keep linear history
LGTM! Thanks!
Hey, I finished the examples.