In computer science, DLL stands for "Dynamically Linked Library" (Also "Dynamic Link Library" [*.dll] on Windows, [*.dylib] on OS X; "Shared Objects" [*.so] on Linux). This means they can be compiled outside of ENIGMA, but ENIGMA games can make calls to them at runtime. Additionally, they are often used for storing pieces of the game's code that may be changed out frequently. Linking the code dynamically allows patches to be made to games to change the behavior of a wide range of events.
In Game Maker, DLLs served mostly as a means of extending the engine. In ENIGMA, however, C++ can already be used to amend or append the engine, and so DLLs will not so frequently be necessary for the sole purpose of extending language functionality.
Part of ENIGMA's philosophy is to not require DLLs in a stand-alone game.
There are presently no solid plans for DLLs in terms of modularizing individual objects in the game, though in the future it is likely for there to be a method of exporting individual objects and functions to separate modules[developer confirmations: 1].
For the purposes of emulating Game Maker's external_define(), a method needs to be used that allows loading DLLs without knowing anything about them at compile time. This presents an issue in a type-safe language such as C++. Originally, small pieces of assembly were used to pull off the feat, but LibFFI later proved to be a more elegant, more encompassing solution.
On Windows, ENIGMA interfaces with [*.dll] link libraries via LibFFI. LibFFI is described as a "Portable Foreign Function Interface Library." It allows calls to be made to external libraries by manually setting up the calling convention when passed a sequence of values and a type index. ENIGMA uses only
double, making the calls to FFI (and the defining of a function from EDL) relatively trivial.
- external_define(dllname,funcname,convention,returntype,argcount,type1,type2,type3...) Defines a DLL function to call, returning its ID.
- external_call(funcID,arg1,arg2,arg3...) Calls a previously defined external function.
- external_free(funcID) Frees a previously defined external function. Frees the DLL if no more of its functions are in use.