FunctionNotFoundException

From Xojo Documentation

Revision as of 14:42, 25 October 2018 by PLefebvre (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Class (inherits from RuntimeException)

A function declared using the Declare statement's "Soft" keyword could not be loaded.

Properties
ErrorNumber Message Reason fa-lock-32.png
Methods
Stack StackFrames

Notes

A FunctionNotFoundException is raised when a Soft Declare statement such as this:

Soft Declare Function getpid Lib "libc" () As Integer

fails to find the specified function or library and it cannot be loaded. If a “hard” Declare fails to load the function, the application will not run at all.

To determine whether the function can be loaded without actually using the Soft Declare, use the System module’s IsFunctionAvailable method. It returns a Boolean indicating whether the function can be loaded on the user’s machine.

Sample Code

The following example adds a RuntimeException handler to the above example.

Soft Declare Function getpid Lib "libc" () As Integer

Exception err As FunctionNotFoundException
MsgBox(err.Message + " Error No.: " + Str(err.ErrorNumber))

See Also

Declare statement, RuntimeException class, Exception, Try statements; System module.