Product Site

5.1.6.3. loadExternalRoutine (Class method)

Resolves a native routine in an external library package and returns a Routine object instance that can be used to call the external routine. The descriptor is a string containing whitespace-delimited tokens that identify the location of the native routine. The first token identifies the type of native routine and must be LIBRARY. The second token must identify the name of the external library. The external library is located using platform-specific mechanisms for loading libraries. For Unix-based systems, the library name is case-sensitive. The third token is optional and specifies the name of the routine within the library package. If not specified, name is used. The routine name is not case sensitive. If the target routine cannot be resolved, .nil is returned.
Example 5.53. Routine class — loadExternalRoutine method
pi = .Routine~loadExternalRoutine("pi", "library rxmath rxcalcpi")
say pi~call(16) -- 3.141592653589793