# MiniFFI

People kept saying this was impossible.

I did it anyway.

Win32API was actually a really dead simple extension, so I wrote my own version of it directly into MKXP. It will run on all Ruby versions because of this.

I'll assume you already know how Win32API works, so I'll skip telling you that bit and stick to what's different.

{% hint style="danger" %}
**Windows:** Something extremely important to remember is that, in MKXP, the Ruby portion of the executable is not run from the main thread. There are a number of WinAPI system functions that just don't work the way you expect (or at all) because of this.

If mkxp-z is built as a 64-bit application, 32-bit DLLs will not work.
{% endhint %}

* Win32API is another name for MiniFFI in this case, not the other way around. This will run on all three platforms, so being called 'Win32API' is a little silly. I picked a dumber name for it instead. In any case, both `MiniFFI.new` and `Win32API.new` create the same class.
* It runs on Linux and macOS. This doesn't mean you can run Windows libraries on those platforms. It *does* mean that you can use libraries built for each respective platform (shared objects with linux, .dylibs and frameworks on macOS).
* 10 maximum arguments instead of 16. You'll probably never even make it to 10. Can be freely changed in source if you so desire.
* `B` and `b` can be used to specify Boolean arguments.
* On 64-bit platforms, `I` and `i` specifically refer to 32-bit integers.
