Determining if a Plugin is installed at Runtime?

Can System.IsFunctionAvailable be used to see if a specific plugin is installed at runtime?
If so can someone post an example?
If not is there a way to do it?

Thanks,

  • karen

In theory I suppose you might be able to but it really won’t matter anyway
If you write something like

  if system.functionavailable( whatever plugin function ) then
           use the plugin 
  else
          do something else
  end if

the app wont even start if the plugin ISN’T available at runtime

Thanks Norm

It’s late and I was not thinking clearly

  • karen

You could use a global variable:

if globals.usePlugin then

'do something
#else
'do something else
#endif

That is evaluated at compile time, not at runtime.

With MBS Plugin you can write code like this:

#if MBS.HasCocoaPlugin
UseMBS
#else
UseOther
#endif

This also is evaluated at compile time in the IDE. The question of Beatrix was:[quote=329554:@Karen Atkocius]…if a specific plugin is installed at runtime?[/quote]

Yes, but it doesn’t make much sense.

Only a decision on compile time can define if the compiler creates code using it or not.

For dynamically loading dylib files and calling functions, you can use our SoftDeclareMBS class.

see
http://www.monkeybreadsoftware.net/class-softdeclarembs.shtml

That is correct but not the question of this thread (as far as I understand Beatrix’ question).

Technically for Xojo Plugins you can check if Pluginentry function is available with System.IsFunctionAvailable.
Not sure what that would help!?

because you don’t know more than if you just saw the dll/dylib there in folder.

Not if it is on a client’s computer.

[quote=329601:@Christian Schmitz]Technically for Xojo Plugins you can check if Pluginentry function is available with System.IsFunctionAvailable.
Not sure what that would help!?

because you don’t know more than if you just saw the dll/dylib there in folder.[/quote]

No you cant
The dylib being absent means the APP will not even start up so you CAN check if the plugin entry is there
Try it
Build an app that uses a plugin
Build the app
REMOVE that plugin dylib
Now try & run the app

I understand that what I asked can’t be done… As I said, It was late and I was not thinking clearly…

What I should have asked was if there is a way, without having to define a boolean to determine at COMPILE time If a plugin is installed… And apparently there is not as it would have come up here anyway.

It theoretically should be possible for Xojo inc to add a feature that worked something like this:

#if PluginInstalled("PluginName") Then 'Use it #Else 'Do it another way #endIf

The biggest reason one might want to do that is for a Xojo class or module so that one intends to distribute…

That way Class/Module user would not need to worry about internals and setting a boolean manually… Which would be much more elegant.

As I said this is something which in theory be doable in the IDE. (And there should be a way to get a plugin Version too)

Don’t know if it is worth a feature request though with a new plugin format coming.

  • karen

please join:
<https://xojo.com/issue/9018>
and
<https://xojo.com/issue/986>

Both of those are STILL COMPILE TIME - not runtime - which is NOT what Karen asked

Given that what I really wanted was execution path control for distributable classes, compile time would be enough given my suggestion above…

Which does seem to be similar to Aaron’s feature request.

  • karen