I have a few external classes (written in Xojo) that I would like to combine into a single library such that I can somehow reference that library in different Xojo desktop applications.
I am thinking in terms of how the Declare statement works for referencing and using Windows APIs. This way, the library (or libraries if they cannot be combined into one) can be placed in a shared folder and referenced by the different programs I’m writing.
Is it possible in Xojo to dynamically load (via code) the library binary and then instantiate the objects that way?
There’s no way to do what you’re describing in Xojo today.
That said, you can use external items.
Create a project that has your library items in it.
Right-click on an item and select “Make External”. If you’re saving in text format, the format of this item should be XML.
In another project, you can drag the library to the navigator while holding down a key combo
CMD-OPT on macOS
CTRL-OPT on Windows (?)
Save the project
This should leave the project in a state where it always references that file.
One item to note:
External item’s don’t auto-update in open projects. That is, if you have two projects open that reference the same external item and make a change in one of them, the change will not be reflected in the other. If you change the other project and save, the changes from the first project may be overwritten.
It would be a great addition. The developer could update the shared library and post the compiled binary on that shared folder and all of the apps that reference it would have those big fixes or additional functionality.
That is not true in 2021r2.1, maybe it’s changed since then. I use a lot of externals and usually have a bunch of apps open, as they’re all part of the same ecosystem. Change something in any external and it’s instantly changed in all open apps.
What does happen is that once an external item is edited in an app, that app becomes the “owner” of that external and the external is not editable in any other open app. Closing and reopening any app restores editability in the newly-reopened app.