Using External Functions

An external function is a routine that is not necessarily associated with any specific class. For details about adding an external function to a class, see "Defining External Functions", in Chapter 8 of the JADE Development Environment User’s Guide.

For details about low‑level C API to obtain JADE initialization file information, directory information, and to convert JADE characters to an ANSI or Unicode string, see "C-Level Application Programming Interface (API)", in Chapter 6 of the JADE Object Manager Guide.

JADE supports external functions only; utility functions written in the JADE language are not supported.

Only one External Functions Browser for the current schema can be open at any time in the JADE development environment. However, you can have concurrent open External Functions Browsers for different schemas in a development session.

Define external function calls for compatibility with the running JADE environment on which the calls are made. For example, calling Windows Application Programming Interfaces (APIs) that pass a Windows handle have different parameter definitions that depend on whether the client is running in 32-bit or 64-bit mode.

To cater for this, you need to establish two different external function call definitions with the required parameter types. Your calling JADE logic must then determine which architecture is being used by the client and which external function call it should therefore make.

External functions are exported from a library and can be called directly from a method written in the JADE language. This enables you to directly call entry points exported from existing third-party libraries or the operating system without having to write an external method wrapper. An external function defines a mapping between JADE parameters and the external parameters. Parameter mapping is made interpretively at run time when an external function is called.

Defining an external function is very much like defining an external method and a subset of the same information is captured. However, external functions are viewed and maintained from the External Functions Browser, accessed from the Browse menu at schema level, unlike external methods that are viewed and maintained from the Class Browser or the Primitive Types Browser.

External function calls are invoked with the JADE language call expression, to make a clear distinction between function calls (that are not invoked on an object) and object method invocations.

For details about external functions declared in the RootSchema jomos external function library that call Windows library functions as defined in the Microsoft Developer Network (MSDN), see Appendix B.