• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

DLLs for extensions mysteriously fail to load for some users

I have an extension on the Marketplace, GMSSimpleMIDI, which allows Gamemaker games to receive MIDI data from keyboards and other controllers, and send MIDI to synthesizers and other devices/programs. For most users (including me) it works great, but a small portion of users can't get Gamemaker to load the DLL, with this error in the compiler window:


Code:
[Run] Run game
Options: Z:/GMSSimpleM_518912EC_93BCA0BF\MainOptions.json
X://windows/Runner.exe  -game "Y:/GMSSimpleMIDI_6E4E60C4_VM\GMSSimpleMIDI.win"
Setting scheduler resolution to 1
Attempting to set gamepadcount to 12
DirectX11: Using hardware device
Collision Event time(microsecs)=11
LoadLibraryW Y:\GMSSimpleMIDI_6E4E60C4_VM\midistuff.dll failed with error code 126
LoadLibraryW Y:\GMSSimpleMIDI_6E4E60C4_VM\midistuff.dll failed with error code 126
LoadLibraryW Y:\GMSSimpleMIDI_6E4E60C4_VM\midistuff.dll failed with error code 126
LoadLibraryW Y:\GMSSimpleMIDI_6E4E60C4_VM\midistuff.dll failed with error code 126
LoadLibraryW Y:\GMSSimpleMIDI_6E4E60C4_VM\midistuff.dll failed with error code 126
LoadLibraryW Y:\GMSSimpleMIDI_6E4E60C4_VM\midistuff.dll failed with error code 126
LoadLibraryW Y:\GMSSimpleMIDI_6E4E60C4_VM\midistuff.dll failed with error code 126
LoadLibraryW Y:\GMSSimpleMIDI_6E4E60C4_VM\midistuff.dll failed with error code 126
LoadLibraryW Y:\GMSSimpleMIDI_6E4E60C4_VM\midistuff.dll failed with error code 126
LoadLibraryW Y:\GMSSimpleMIDI_6E4E60C4_VM\midistuff.dll failed with error code 126
LoadLibraryW Y:\GMSSimpleMIDI_6E4E60C4_VM\midistuff.dll failed with error code 126
LoadLibraryW Y:\GMSSimpleMIDI_6E4E60C4_VM\midistuff.dll failed with error code 126
LoadLibraryW Y:\GMSSimpleMIDI_6E4E60C4_VM\midistuff.dll failed with error code 126
LoadLibraryW Y:\GMSSimpleMIDI_6E4E60C4_VM\midistuff.dll failed with error code 126
Total memory used = 7630675(0x00746f53) bytes
**********************************.
Entering main loop.
**********************************.
Pause event has been registered for this frame

Error code 126 is a generic Windows error for when DLLs fail to open. It appears that the DLL can't be opened at all on their system - besides the error, there are some messages the DLL should be printing to the console just from running the initial function that doesn't get printed. Does anyone know what might be causing this?

The DLL is complied for x86 to match the YYG runner. Recompiling for x64 and using it with the config box "use x64 Windows runtime" gives me the same error, and the people who've reported this say they're not using the x64 runtime. I've also read that one of the libraries I use in the DLL (RTMidi) can have issues with certain programs requiring CoInitializeEx() and CoUninitialize() to be called before accessing the thread, but that doesn't appear to fix the issue either.
 

chamaeleon

Member
I'm going to guess it comes down to the DLL not having all required dependencies (versions being satisfied, etc.) available for Windows to successfully load it.
 

ThraxxMedia

Member
/edit: *never mind, brain fart* (I was assuming something along the lines of: 32 vs 64 bit, since I've had a similar problem before, too)
 
I'm going to guess it comes down to the DLL not having all required dependencies (versions being satisfied, etc.) available for Windows to successfully load it.
Can you elaborate on that? It shouldn't require anything but itself and the Windows Multimedia API, but if they had issues with that, they wouldn't be able to run other audio software that reportedly runs just fine.
 

chamaeleon

Member
Can you elaborate on that? It shouldn't require anything but itself and the Windows Multimedia API, but if they had issues with that, they wouldn't be able to run other audio software that reportedly runs just fine.
Start with checking dependencies using dumpbin to verify what it requires
Code:
> dumpbin /dependents midistuff.dll
 

Nobody

Member
I'm going to guess it comes down to the DLL not having all required dependencies (versions being satisfied, etc.) available for Windows to successfully load it.
Exactly that!

The most likely candidate being the Visual Studio redist’s.

I normally build my dll’s in a way that the VS libs are static linked. Makes the dll slightly bigger (like 200kb more) but the size difference is negligible and stops this from happening.
 
which can be done with /MT in project properties.

/MD, -MT, -LD (Use Run-Time Library) | Microsoft Docs
I was literally typing, "How do I do that?" as you posted this, thanks!

After running dumpbin it seems that it's most likely that they don't have the C++ redistributable. I also included the debug version instead of the release version of the DLL in the extension, that's probably been causing some problems as well. I'll make the changes and see if the user can make it work. Thanks everyone!
 
Top