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.
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?
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.
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
February 5, 2013 at 09:10 am - Permalink
February 5, 2013 at 10:17 am - Permalink
February 5, 2013 at 10:40 am - Permalink
Adam Taylor
February 5, 2013 at 02:09 pm - Permalink
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.
February 5, 2013 at 03:06 pm - Permalink
Adam Taylor
February 5, 2013 at 10:20 pm - Permalink
February 6, 2013 at 06:29 pm - Permalink