How to create Xojo plugin using Xcode

Hi all

Here’s a brief document that shows how to create a plugin using the SDK and Xcode (because it’s not obvious, and not documented).

How to create a Xojo-plugin project from scratch using Xcode 4.2.1 on OSX 10.7.5

DemoPlugin.zip is the source code for this example.

Hope it helps all the budding plugin developers out there.

Matt.

[quote=16530:@Matthew Gardner]Hi all

Here’s a brief document that shows how to create a plugin using the SDK and Xcode (because it’s not obvious, and not documented).

How to create a Xojo-plugin project from scratch using Xcode 4.2.1 on OSX 10.7.5

DemoPlugin.zip is the source code for this example.

Hope it helps all the budding plugin developers out there.

Matt.[/quote]

For what it’s worth, the reason you need to disable CLANG_ENABLE_OBJC_ARC is that ARC is only compatible with the 64-bit Objective-C runtime.

Matthew,

I just read your PDF while consuming a rather large double quarter pounder. At least I don’t feel sick from consuming your PDF. Very helpful and a great document. I’ll be giving it a try. Thanks

Mike

Updated the how-to guide (now using Xcode 4.6.3 which is more stable) and an example “add5” function.

Cool, thank you for posting this. I even managed to get it to work. :slight_smile:

Are there any tutorials on writing plugins for Xojo?

Hi Thomas, none that are current unfortunately as the framework has changed a bit and lots of older tutorials use deprecated functions, which is why I started the document and sample project.

I’d recommend having a good read through the CompleteModule.cpp example (in Xojo/Extras/Plugin SDK/Examples/Complete Module) for insights into creating additional methods in your module, adding properties etc.

Tip: If you assign the global option to any of your methods (like I did in the example) you are then able to use the method without referencing the module (so it looks just like an ordinary part of Xojo - at least that’s my understanding), however Xojo is making a definite move to modules and frameworks, so it’s probably better to start using your plugins that way too (e.g. use modulename.methodname instead of just methodname).

Good luck.

It wouldn’t hurt if someone filed a Feedback request for better documentation and examples for the plugins sdk.

Thank you again Matthew. The Complete Example include in 2013 R2 does not compile as is for me. I in general, always try and use the name space of a module.

Feature request filed Joe. 28609 - Plugin Documentation and Examples

Thanks for this Matt. Very helpful and something I would’ve liked to see from RS years ago. Altho I’ve written a large plugin myself, and ported it successfully to Xcode 4 (and likely Xojo tho not tested yet), I was never quite clear on how/why it worked, and th.f. always terrified how easily I can break it with one target setting change or include file.

Having a clear path to source level debugging in Xcode and eventually instructions on supporting 32/64 bit plugins would also be most welcome (yes, filed).

Peter.

I would like to see an example that presents a cross-platform graphical control. There are a lot of details that need to be addressed for cross-platform and GUI interaction with XOJO apps. Maybe presenting a text field or button in a functional manner. This would show how to manage event relay from Cocoa (and windows) controls created in the plugin and the XOJO app.

Hi all ,

i found something probably very useful from Pierre MOLINARO who work in CNRS in France.

he build a multi-platform distribution package for Windows and Linux CROSS COMPILING on OSX !

here is the ling to the Pierre MOLINARO Page : http://crossgcc.rts-software.org/doku.php?id=compiling_for_win32

i hope this will allow to help us to port our old plugins (never recompiled since Metrowerks stop !)

Perhaps somebody will find how to integrate the Pierre tool’s in XCODE environment

Happy New Year !

Didier Cugy (France)

I haven’t tried it, and theoretically a cross platform control should be able to be created by Component Object Model.

Component Object Model (COM) Development on Mac OS X

I have ordered a few books from Amazon and was going to see if I could get something working once they arrive. If someone is able to create a simple COM program on Mac, we can give it a go on Windows just to try.

Yes, a cross compiled program such as Metrowerks for Plugins would be great!

Hello

Followed the example above to build a plugin…but what I’m missing is, how to be able to use the custom function(s) from a XCode plugin inside Xojo…

Just using the “add5” function from the example above won’t work (o;

And…how do I know the plug-in is actually loaded or not?

You have to copy the created dylib to the Xojo Plugin folder and restart Xojo.

Well…that’s what I did (o;

Ah got it…Xojo is still using 32bit plugins…

Wonder when this ever will be 64bit :wink:

I have my plugins already compiled for 64bit…
But can’t test and only using the 32bit SDk.

I was so proud on having set up quite a lot of SpriteKit only to find out the Framework runs on 64bit exclusively when I instantiated it for the first time. But hey, let‘ wait for the iOS version. I guess you are set up to go with MBSiOS plugins, Christian? :wink:
(Although, for the sake of learning, I really would appreciate if we would start on an iOSLib as well…)

Hmm…now the next problem…

Won’t compile when using CoreFoundation framework included…

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:19:10: ‘CoreFoundation/CoreFoundation.h’ file not found

I have a couple of plugins developed which are waiting for 64bit target.

Forum for Xojo Programming Language and IDE. Copyright © 2021 Xojo, Inc.