Using
UnmanagedExports,
DllExport, or
DNNE, it might conceivably be possible to do this, however, the easiest solution to use, UnmanagedExports, has not been touched in years, DllExport (somewhat based on UnmanagedExports, possibly) seems complex and does some kind of project file changes behind the scenes using a GUI tool, and DNNE is in its infancy still.
A few years ago I made a test (not related to GMS at the time) using UnmanagedExports and, I think .NET framework 4.5.2
C#:
using System.Runtime.InteropServices;
namespace Adder
{
public class Class1
{
[DllExport("add", CallingConvention = CallingConvention.Cdecl)]
static public double add(double a, double b)
{
return a + b;
}
}
}
This exposed a function, add, which could be found by that name and called. I believe this would work.
Making a new copy of this project and changing int to double, allowed the definition of a GMSAdder extension, containing the DLL generated (using the same architecture as the GMS project, in my case x64), and mapping the DLL add function to GMSAdder_add.
GML:
show_debug_message("Adding 1 and 2 = " + string(GMSAdder_add(1, 2)));
The main pain point will most assuredly be with handling strings, and performing memory allocations and deallocations safely and correctly. I have no direct insight into the best way to achieve this, but presumably it will involve convoluted Marshal-related code.