Way to test for the presence of a XOP in a program?

Is there a way to test for the presence of a XOP in a program? I would like to test if a XOP is present, and if it is then call one of its functions, but if not then do something else. I'm trying to test whether a particular piece of hardware is attached to the computer, and if it is attached, then the user has (hopefully) installed the XOP that allows Igor to talk to it.

I've looked in the manuals and searched this forum, but couldn't find anything about this question.

Thanks in advance,
Adam Taylor

Use the FunctionInfo function:

DisplayHelpTopic "FunctionInfo"

Pick a function that your XOP defines. If it doesn't exist, then the string returned has zero length, and the XOP isn't loaded:

•print strlen(functioninfo("xxx"))
0

There is an optional second input that you can use the restrict the scope of the function.

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
With the exists function would you have to test for whether or not it returns "4" since it would otherwise test for both functions, macros, and other items in addition to operations?
tkessler wrote:
With the exists function would you have to test for whether or not it returns "4" since it would otherwise test for both functions, macros, and other items in addition to operations?


It would be a good idea to test for "4". However if there were functions or macros with the same name you would get compile errors due to conflicts. Consequently testing for !=0 would be good enough. But "4" is more explicit.
Don't forget conditional compilation:
displayhelptopic "Conditional Compilation"