Pages: 1
Author Topic: Cross-Platform External DLL Functions Now Supported  (Read 1784 times)
Offline (Male) time-killer-games
Posted on: May 03, 2020, 03:22:16 PM

Location: Virginia Beach
Joined: Jan 2013
Posts: 1170

View Profile Email
Hey guys!

Robert fixed our Windows functions for calling DLL's so that they can use strings correctly. I decided to add to this vast improvement by making these functions work on Mac OS X, Linux, and FreeBSD. Mac is still broken so it's not tested on there, but there's no reason why it wouldn't work, once the Cocoa and Mac SDL platforms get patched.

Functions introduced by this extension:
- external_define(dll, name, calltype, restype, argnumb, argtype[0], argtype[1], ...argtype[10])
- external_call(id, args[0...15])
- external_free(id)

Example project demonstrating the use of external functions:

Example DLL source code:

This means nearly all GameMaker extensions for Desktop Platforms should now work in ENIGMA out-of-the-box, whether for GameMaker Studio or older versions of GameMaker. Although you will need to set a compatibility mode for the version of GM your extension is built for in order to get window_handle() working. The only thing to be done is to convert your extension to use scripts with the external functions because we don't support GameMaker's special extension package formats yet. Due to POSIX and/or X11 compliance, a lot of Linux and Mac OS X extensions can be rebuilt and "just work" on FreeBSD in a lot of cases if you have the source code handy.

To get access to these new features, simply update enigma to the latest version and enable the "External Functions" extension like so:

You will also need to install libffi. Windows users should already have this installed because we've included it on our Windows Installation page for a long time now. As for everyone else, the dependency can be installed for your platform using the terminal commands below...

Ubuntu/Debian-Linux based:
Code: [Select]
sudo apt-get install libffi-dev
Arch/Manjaro-Linux based:
Code: [Select]
sudo pacman -Sy libffi
Code: [Select]
sudo pkg ins libffi
Have a wonderful day.
« Last Edit: May 03, 2020, 03:39:59 PM by time-killer-games » Logged
Pages: 1