Looks like DLLs compiled with msys2 cannot be loaded by FFI. DLLs produced by VS C++ work without issues.