How to check presence of 3rd party plugin from AFL?

There are some formulas that use 3rd party plugin functions.
And some of you might wonder if it is possible to display a meaningful error message when plugin is missing. Here is an example code that shows how to detect if plugin-provided function is available and display meaningful error message when it isn't.

// Check the function identifier. If plugin is not installed it will be "undefined"
// If it is installed the identifier will be "function"
if( typeof( NorgateIndexConstituentTimeSeries ) == "function" )
{
  printf("Norgate plugin installed");
}
else
{
  Error("Norgate plugin is missing");
  _exit();
}
8 Likes

As it turns out, actual plugin function has different name zzzNorgateDataIndexConstituentTimeSeries and NorgateIndexConstituentTimeSeries is just AFL wrapper.

So to detect actual plugin being loaded, the code would need to use real plugin-exported function:

if( typeof( zzzNorgateDataIndexConstituentTimeSeries ) == "function" )
{
  printf("Norgate plugin installed");
}
else
{
  Error("Norgate plugin is missing");
  _exit();
}

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.