How to make a Raspberry Pi Plugin?

I am attempting to make a Hello-World Raspberry Plugin just to get me started and can’t seem to have Xojo 2022 r4.1 to recognize the plugin. Does anyone have suggestions as to what I may be doing wrong?

Here are some of my presumptions:

  1. Create a 64-bit plugin on Ubuntu Linux (Xojo is 64-bit, so I am using a 64-bit version).
  2. The Raspberry Pi 4B is a 32-bit operating system (making functions/pointers 32-bit compatible)
  3. The plugin ( does not load, and shows the following error in the Xojo IDE (Could not open plugin format)
  1. The plugin should allow typing of code with a RPiSS. prefix

Here are the compiler commands:

  1. gcc -c LibGPIODPlugin.c -o LibGPIODPlugin.o //builds an .o file from the c source
  2. ar rcs LibGPIOPlugin.a LibGPIODPlugin.o //builds an a file
  3. gcc -shared LibGPIODPlugin.o -o //creates the .so library

Here is my C code:

#include </home/eugenedakin/Desktop/Plugin/Includes/LinuxHeader.h>
#include </home/eugenedakin/Desktop/Plugin/Includes/REALplugin.h>
#include </home/eugenedakin/Desktop/Plugin/Includes/rb_plugin_deprecated.h>
//#include </home/eugenedakin/Desktop/Plugin/GlueCode/PluginMain.cpp>
#include <stdio.h>
#include <string.h>

//Forward Declarations
static REALstring VERSIONSS(void);

REALmethodDefinition RPiXojoModuleMethods[] = {
	{(REALproc)VERSIONSS, REALnoImplementation, "Version() as String", REALconsoleSafe},

REALconstant RPiXojoModuleConstants[] = {
{ "Pi = 3.141592653589793238" },
{ "Pi_VERSION = 4"},

REALmoduleDefinition RPiXojodefn = {
	"RPiSS", //Name of module shown to user
	RPiXojoModuleMethods, // Method names
	sizeof(RPiXojoModuleMethods) / sizeof(REALmethodDefinition), //Method Size
	RPiXojoModuleConstants, //Constant names
	sizeof(RPiXojoModuleConstants) / sizeof(REALconstant), //Constant Size
	nil, //eProperties,
	0, //Property count
	nil, //Structures,
	0, //Structure count
	nil, //REALenum *enums;
	0, //size_t enumCount;
	nil, //REALattribute *attributes;
	0, //size_t attributeCount;
	nil, //REALdelegate *delegates;
	0, //size_t delegateCount; REALBuildStringWithEncoding
	nil, //REALclassDefinition **classes;
	0, //size_t classes count
	nil, //REALinterfaceDefinition *interfaces;// Assumes this module’s namespace
	0, //size_t interfaceCount;
	nil, //struct REALmoduleDefinition **modules;// Assumes this module’s namespace
	0, //size_t moduleCount;
	nil, //REALcontrol **controls; // Assumes this module’s namespace
	0, //size_t controlCount;

static REALstring VERSIONSS(void)
{	//std::string VERSION_MAJOR = "1";
	//std::string VERSION_MINOR = "0";
	//std::string VERSION_PATCH = "0";
	//std::string VERSION_BUILD = "0";
	//Reminder - update in main plugin folder
	const char* VerString = "Plugin:RPiXojoPlugin \nVersion: \nAuthor:Eugene Dakin\n GUID:E04F9180-6183-4B55-8C4A-1BD2B1E2470A\n";
	return REALBuildStringWithEncoding(VerString, strlen(VerString), kREALTextEncodingASCII);

Thanks for your help :slight_smile:

You need to link with some libraries.

You will find makefile that should give you some idea in our open source plugins.

There is also the issue of the c++ runtimes. Xojo ships with libc++ which is for Clang 3.4 (works up to 3.6) on all Linux platforms except Arm64 there the library is newer (I forgot which 9 or 11 or something)

Xojo ships this with Xojo to guaranty that the Xojo can launch no matter which C++ libraries are on the Linux system

So in this all you have 2 ways.

  1. Do as Christian, just use GCC and link with something old and hope that particular runtime is in the user linux system.

  2. Do as I do and try to make use of the libc++ that ships with Xojo. This does work but problem is this library is ancient to say the least (on all except Arm64) and I am unable my self to get up new system that can build against the ancient clang 3.4 library. (I have tried recently, but I have old working systems for it)

So you have some mess to choose from here. I personally think Xojo needs to and should probably update this libc++ which they ship with Xojo to something sensible.

Regardless of which way you go then the makefile in my open source things should still give good hints since there is not much difference in the makefile if you use clang or gcc.

1 Like

Hi Bjorn,

It looks like I am missing many parts to this plugin-puzzle. I will go through your helpful comments and work through them step-by-step.

Thank you for your wealth of information!

Warm regards.