msys2 for 32 and 64 bit DLLs

Here is how to use msys2 to make 64-bit (and 32-bit) Windows DLL’s for Xojo plugins. I use an iMac with OS X 10.11.2. Parallels has Windows 10 installed.

On your 64-bit Windows:

  1. Go to and download msys2-x86_64-20150916.exe. Run it and accept the defaults except to make sure msys64 is installed on Drive C:. The installation will take some time.

  2. As you’ll see later, I’m not sure the following is necessary. Open “c:/msys64/etc/fstab” with a text editor and add the line (without quotes) “c:/msys64/mingw64 /mingw64” followed by a blank line.

  3. In the msys64 folder open “mingw64_shell”. You’ll see a terminal-like window. Notice it is Unix-like using / and not \ as does the Windows brand of Unix. In order to have the g++ command recognized give this command:

pacman -S mingw-w64-x86_64-toolchain

Accept the defaults. Again it will take some time.

  1. Close that terminal window and open the mingw32_shell. For 32-bit g++ to be recognized give the command:

pacman -S ming-w64-i686-toolchain

I could never get the msys2_shell recognize the g++ command, but the mingw shells are all that you need to make DLL’s for Windows.

  1. Download from my website:

The Projects folder should be copied to the C: drive, but keep the original for later. It contains the makefile and files to create a DLL for a simple Xojo plugin which handles complex numbers.

The RBPlugins folder contains the latest GlueCode and Includes folders from Xojo’s PluginsSDK, but which have been modified. The modifications were necessary since two of the unmodified files gave make errors like:

In file included from C:/Projects/RBplugins/Includes/rb_plugin.h:21:0,
from Complex.cpp:9:
C:/Projects/RBplugins/Includes/rb_plugin_deprecated.h:391:123: error: conflictig declaration of C function ‘void REALDrawPicturePrimitive(REALgraphics, REALpiture, const Rect*, int)’

The errors were corrected in rb_plugin_deprecated.h and PluginMain.cpp by commenting out. The corrected errors in PluginMain.cpp were all in the section titled “DEPRECATED FUNCTIONALITY” so I suspect you’ll have no problem if you avoid certain deprecated functions.

  1. If you don’t have a shortcut on the Desktop, open the msys64 folder and double-click “mingw64_shell”. Give the command:

cd /c/Projects/libComplex

Although you don’t need to, give the command


You should see a listing of the complex project files and the makefile. Give the command


If all goes well the make should complete without error and give a command prompt. Close the shell and open the libComplex folder. There you should find “libComplex.DLL”. Copy it elsewhere and rename it “libComplex32.DLL.

Copy the original Projects folder to the C: drive replacing the one there. This is necessary since that last folder contains the 64-bit object files which would confuse the next 32-bit make. In the libComplex folder use a text editor to open the makefile. Change the line

CC = g++ -m64


CC = g++ -m32

and save and close.

Open the mingw32_shell and repeat what you did for the 64-bit make. Rename the DLL as libComplex32.DLL.

To test your DLL’s I have a Mac and Windows aware plugin on my website:

Replace .xojo_plugin by .zip and decompress. The resulting ComplexPlugin folder contains the folder “Build Resources”, which in turn contains five folders. In the Windows folder replace that 32-bit DLL by yours. In the Windows x86-64 folder replace with your 64-bit DLL. Compress the ComplexPlugin folder and replace .zip with .xojo_plugin.

Put that plugin in the Xojo Plugins folder. Create a project of some chosen name with three TextFields labelled x, y, and z. Also create four buttons Add, Sub, Mul, Div. The script for the Add button:

Dim x, y, z As Complex
x = new Complex(TextFieldx.text)
y = new Complex(TextFieldy.text)
z = x + y
TextFieldz.text = CStr(z) // or z.str

Do the same, with an obvious change, for the other buttons.

Now you can make Windows and Mac 32 and 64 bit Xojo applications for testing.

It might be useful to show some problems which arose before I was able to do a successful Windows make. I did not create that makefile; years ago I downloaded an example makefile for Windows from some website. The problem line in the makefile is:

all: $(OBJS)
$(CC) $(CFLAGS) -shared -o libComplex.DLL $(OBJS) -static

For years I used this version:

all: $(OBJS)
$(CC) $(CFLAGS) -shared -o libComplex.DLL $(OBJS)

My iMac running Windows 7 under Parallels crashed and could not be fixed. I did not have a copy of the Parallels installation, so on my new iMac I installed Parallels with Windows 10. I couldn’t get the mays installation to work; it wouldn’t recognize the g++ command. Eventually I found msys2. But that last makefiles command produced DLL’s which wouldn’t give working Xojo Windows applications. The Mac side always worked.

Finally I was able to produce successful DLL’s for my (very large) fp Plugin with this internet-suggested makefiles line:

all: $(OBJS)
$(CC) $(CFLAGS) -shared -o libfpPlugin.DLL $(OBJS) -static-libgcc -static-libstdc++ -Wl,-Bstatic -lstdc++ -lpthread

Thinking I had solved the problem, I created a Xojo application using the Complex type (the above example). In Windows 10 when either the 32-bit or 64-bit version was double-clicked, there was some very brief action and then nothing happened. There was no error message or other sign that an .exe file had been double-clicked. Windows 10 was just in its normal waiting state. Using the right-click and “troubleshoot compatibility” gave no clues whatsoever. Nor did “depends22_x86”. Finally on the internet I found a suggestion that led to the successful makefile command:

all: $(OBJS)
$(CC) $(CFLAGS) -shared -o libComplex.DLL $(OBJS) -static

which appears to include all necessary static libraries. I remade my fp Plugin DLLs with the revised makefile and they were again successful in making working Xojo applications.

I hope the above is of help to others.


In the example Complex application a complex number is input as 2,3 or 2, 3.


Have you filed a bug report about this?

No, because I suspect the errors are unique to the mingw installation.