vdweller
Member
NOTE: I don't want advice on how to create an extension. My question is about writing dlls and calling functions from them. Unless the only way to use a dll is now only by an extension, please don't discuss extensions.
1. Go to code::blocks, create a new dll file.
2. Write:
(as per @icuurd12b42 's old tutorial) . Build .dll.
3. Go to GMS2, new project, include dll in "Included Files", Room Creation, write:
Result:
"Error defining an external function"
show_debug_message(file_exists("Test_DLL.dll")); returns 1.
Also verified "SampleFunction" existence and parameters.
Same with GMS2's dll template.
So...is this info obsolete? Something I am missing? Do we do things differently in GM:S2?
Edit: GMS2 output also mentions "LoadLibraryA failed with error code 126".
1. Go to code::blocks, create a new dll file.
2. Write:
Code:
#define GMEXPORT extern "C" __declspec (dllexport)
GMEXPORT double SampleFunction(double a, double b) {
return a * b;
}
3. Go to GMS2, new project, include dll in "Included Files", Room Creation, write:
Code:
var my_function = external_define("Test_DLL.dll", "SampleFunction", dll_cdecl, ty_real, 2,ty_real,ty_real);
var a = external_call(my_function,1,2);
show_debug_message(a);
"Error defining an external function"
show_debug_message(file_exists("Test_DLL.dll")); returns 1.
Also verified "SampleFunction" existence and parameters.
Same with GMS2's dll template.
So...is this info obsolete? Something I am missing? Do we do things differently in GM:S2?
Edit: GMS2 output also mentions "LoadLibraryA failed with error code 126".
Last edited: