ENIGMA Forums

General fluff => Announcements => Topic started by: time-killer-games on May 03, 2020, 03:22:16 pm

Title: Cross-Platform External DLL Functions Now Supported
Post by: time-killer-games on May 03, 2020, 03:22:16 pm
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]) (https://docs.yoyogames.com/source/dadiospice/002_reference/miscellaneous/external_define.html)
- external_call(id, args[0...15]) (https://docs.yoyogames.com/source/dadiospice/002_reference/miscellaneous/external_call.html)
- external_free(id) (https://docs.yoyogames.com/source/dadiospice/002_reference/miscellaneous/external_free.html)

Example project demonstrating the use of external functions:
https://enigma-dev.org/edc/games.php?game=111

Example DLL source code:
https://github.com/time-killer-games/DialogModule

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:

(https://i.imgur.com/HG1aKkm.png)

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
FreeBSD-based:
Code: [Select]
sudo pkg ins libffi
Have a wonderful day.
Samuel