• 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.

Windows External DLLs in GMS2

The music in my project is very dependent on DLLs, specifically the FMOD DLL and the S-Winamp DLL (with out_wave.dll and in_festalon.dll/in_nsf.dll as components). These worked perfectly in Game Maker Studio 1.4, but refuse to work in Game Maker Studio 2 when I import my project.

The FMOD DLL shows several "Error defining external function" errors, while the S-Winamp DLL crashes the game when attempting to do pretty much anything (including playing a music file and changing the volume). I'm not sure if this is specific to these DLLs, but since none of them worked I imagine it has something to do with a compatibility issue in Game Maker Studio 2.

All DLLs are in the Included Files section. S-Winamp has a dedicated Extension whereas FMOD does not. Does anyone happen to know why this is happening, and if so, knows how to fix this? Many thanks in advance!

If it's any relevant: I'm using the desktop version of 2.0.5.77, the latest version to my knowledge. I've also tried both the VM and YYC methods; the only difference is that the YYC version does not play any music instead of crashing the game, but aside from that they appear to give identical results.
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
The functions for defining external functions in GML for GMS2 are deprecated and can only be used with ONE function per dll (which makes them kind of useless)... The manual will be updated to reflect this information as currently it isn't mentioned. you need to re-package your extensions using the GMS2 extension editor, and add all the functions in as part of the extension and through scripts.
 
The functions for defining external functions in GML for GMS2 are deprecated and can only be used with ONE function per dll (which makes them kind of useless)... The manual will be updated to reflect this information as currently it isn't mentioned. you need to re-package your extensions using the GMS2 extension editor, and add all the functions in as part of the extension and through scripts.
Hmm, I see, thanks! I'm not that experienced with GMS2's extension system, though. Is there some kind of tutorial on how to do what you just said?
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
Okay, quick update here. I'm sorry to say my reply was completely and utterly wrong. :(

you CAN use those functions and they are NOT deprecated in any way at all. Yes, you probably should be defining the external functions with the extension editor, but you should also be able use external_define. So, sorry for wasting your time and if you still want help with the original issue,m then please post an example of what you are doing to define the functions and a snippet of the compiler output with the full error message.
 

Mick

Member
edit: perhaps this can be used to create a dll (probably updated compared to that s-winamp plugin?) and use it instead? https://bitbucket.org/mpyne/game-music-emu/overview
I'm working on an extension using game_music_emu, I actually already have it working on Windows, Mac OS X, Linux and Android. It uses an audio queue for playback so no external sound system is needed. game_music_emu is licensed under LGPL so it can be dynamically linked (dll, dylib, so) in a game.
 
Sorry for my late reply, but thanks for the replies everyone!

The error FMOD gives me is as follows:
Code:
___________________________________________
############################################################################################
ERROR in
action number 1
of Alarm Event for alarm 3
for object objGlobalControl:

Error defining an external function.
 at gml_Script_LoadFMOD (line 14) - global.dll_FMODfree=external_define("GMFMODSimple.dll","FMODfree",dll_stdcall,ty_real,0);
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Script_LoadFMOD (line 14)
called from - gml_Object_objGlobalControl_Alarm_3 (line 1) - LoadFMOD();
Here's the part of the script that seems to cause the issue:
Code:
//export double FMODfree(void)
global.dll_FMODfree=external_define("GMFMODSimple.dll","FMODfree",dll_stdcall,ty_real,0);
Note that even if I comment this out, the game throws an error at the next instance of external_define. This even applies to entirely different scripts that use external_define to communicate with FMOD. However, I've seen other threads discussing similar FMOD-related problems, so it might just be a matter of time before this gets fixed (and I'm not in a hurry or anything).


As for the Winamp/NSF problem: whenever it tries to play music, the game just crashes; no error message or anything, the program just stops responding. I could go into more detail here (such as where I downloaded the files and what scripts the extension is using) but if Mick's extension ends up being as useful as it sounds, I'll gladly wait for that one (and in the meantime, I could just continue development in GMS1).


Thanks again for the replies!
 
Thank you Mick! It's working perfectly so far and it's much easier to set up than the system I used previously. Many thanks, this really helped me out!
 
Top