Xojo doesn't find method in Windows plugin example

I’m looking to try and create a plugin for some C++ code with Xojo, being a noob I figured I would start small. Did some Googling and found that not much exists and what does is fragmented. I did purchase Eugene Dakin’s e-book (updated last in 2015) and while it did help a bit I could not get his simple “FirstPlugin” working.

I was able to create a dll using VS2017 and his instructions, I then stumbled as dropping the DLL into the Plugins directory isn’t what’s needed, after some more digging I found out how to package the DLL (PluginPackaging.rtf) as a xojo_plugin.

Now the sample Project for FirstPlugin can’t find the “AddTwo()” method from the example. Any thoughts on where to look next would be appreciated, there were no errors when I started Xojo but I guess it’s possible the plugin wasn’t loaded?

I’m running Xojo 2018r4 currently.

Thanks,
Mike

You could just make a dummy AddTwo function or your own…

Hi Mike,

I am away from my computer and will look at the example tonight to help you out. I hope to be at the computer in about 3 hours or so (6:00 pm mountain standard time).

Teaser: I am in the process of updating this book to Visual Studio 2017 and there have been many changes. This update will take some time.

Thanks for the feedback, I know things have changed since 2015. I was able to hack through and find where the VS2017 settings are (as opposed to VS2013) so I’m fairly sure that went ok. There has to be something I’ve missed in the process, I got the DLL created, added it to what I believe is a properly formatted zip (xojo_plugin) file and dropped it into the Plugins directory. Rechecked the naming in the example and that looks ok.

Hi Mike,

Glad to hear you are making progress. I am still working on it.

To try the dll, don’t worry about packaging a zip file, and just place the dll in the plugins folder in Xojo and restart the IDE to see if the AddTwo function works.

I’ll keep working on it in the meantime :slight_smile:

Everything needs to be 64-bit to work. This can be completed by selecting the x64 Release version in Visual Studio and then ReBuild the solution. This will make a 64-bit dynamic link library.

Copy and paste the 64-bit DLL to the plugins folder and start Xojo. Before you create a program, switch the Xojo Windows program to 64-bit by selecting Windows in the Build Settings and select “x86 64-bit” Architecture.

To check if the plugin has loaded, selected “Help” in the Xojo IDE, select “About Xojo” and press the “Loaded Plugins” button. The name of the plugin that was created and placed in the Xojo Plugins folder should appear here.

Yep… I need to update this book… :slight_smile:

Edit: The examples work when set to 64-bit.

It’s important to place the dll in the Plugins folder and then start the IDE.
If you replace an existing dll (or any other plugin for that matter) you MUST restart the IDE.

@Eugene Dakin
Perhaps you could update to the new released Visual Studio 2019?
Your book could have a longer life span.

Thanks for all your helpful books.

[quote=432485:@Jens Knaack]@Eugene Dakin
Perhaps you could update to the new released Visual Studio 2019?[/quote]

Thanks for letting me know that Visual Studio 2019 is available. I’ll try a few examples in VS 2019 and if they work then I’ll update the book and examples to this version.

This is a great tip!

Ok, rebuilt as 64bit and tried again but no joy. I tried dropping the DLL into /Plugins as well as packaging into a xojo_plugin, as always both times the IDE was shut down and restarted after the plugin/dll was dropped. Xojo doesn’t show the plugin as loaded so I guess this makes sense but unclear why.

There is however a small wrinkle, I have 2 licensed copies of Xojo and this actually works on one but not the other, let me explain:

The copy of Xojo that this is NOT working on is my employers copy, there I run on MacOS but that is licensed to build for both Mac and Windows platforms.

The copy of Xojo that this IS working on is my personal one, it’s only licensed to build Windows applications and runs on Win10. On that one both the DLL and the packaged xojo_plugin both get loaded and all is good.

I’ll keep digging, thanks.

if I am not mistaken, the windows IDE requires 32-bit to see the plugin

I initially built 32-bit first and that didn’t work.

[quote=432503:@Mike H]The copy of Xojo that this is NOT working on is my employers copy, there I run on MacOS but that is licensed to build for both Mac and Windows platforms.

The copy of Xojo that this IS working on is my personal one, it’s only licensed to build Windows applications and runs on Win10. On that one both the DLL and the packaged xojo_plugin both get loaded and all is good.
[/quote]

On a Mac you need to have a suitable Mac dylib (or package the entire thing with Windows dll & Mac dylibs in the plugin)
MacOS cannot load a Windows DLL - nor can Windows open & load a Mac dylib