jarikomppa / soloud

Free, easy, portable audio engine for games
http://soloud-audio.com
Other
1.69k stars 270 forks source link

Crash after migrating project to MSVC 2019 from MSVC 2017 #315

Closed dantamont closed 3 years ago

dantamont commented 3 years ago

Expected behavior/Actual behavior

Hey folks, I had soloud running just dandy with Visual Studio 2017 (Win32). Things were working great. However, I've migrated to Visual Studio 2019 (Win32), and now soloud is crashing on me. I am generating my solution with the command:

genie --with-sdl2-only --platform=x32 vs2019

and using SoloudStatic to build SoLoud as a static library, which I then link to my project using cmake.

Steps to reproduce the problem:

Here is the problem code:

auto* sl = new SoLoud::Soloud();
SoLoud::result result = m_soLoud->init();
if (result) {
    SoLoud::SOLOUD_ERRORS err = SoLoud::SOLOUD_ERRORS(result);
    throw("Error initializing SoLoud");
}

The error that I get is an unknown error (7), so that's not very helpful.

I have no idea what could be causing this all of a sudden. Anybody have any suggestions? I unfortunately can't migrate back to MSVC 2017, so I'd appreciate any help.

SoLoud version, operating system, backend used, any other potentially useful information:

I am using the latest stable SoLoud release from the main website, soloud20200207.

Edit: So, I've realized that msvc2019 isn't supported as a flag, only msvc2017. However, the MSVC 2017 build of SoLoud is still crashing in the same spot. I'm going to try compiling the source directly in my project and see if that makes a difference.

Edit 2: I wasn't including the *.c files from SoLoud properly in my CMake, but now I'm successfully building SoLoud without the need for any other libraries. Unfortunately, I'm still getting the same mysterious crash as before.

dantamont commented 3 years ago

Solved it! Embarrassingly, my DLL got deleted at some point, but SoLoud doesn't return a specific error if you don't manually tell it your backend on initialization. All is well now.