-
Notifications
You must be signed in to change notification settings - Fork 0
Extern Classes and Functions
An extern class definition is used to wrap native Java code. Much of the Aussom standard library is written in Java and is used by defining extern classes. We won't get into writing external modules in this document, but this is the purpose of the extern key word.
If a class is identified as extern, it may then have functions that are also identified as extern. These function definitions do not define the behavior of the function, just the name and the arguments that are provided.
The example below is from the sys library. It references the stdlib.sys java class, and the extern functions show below define the Java functions that they represent. These functions can be called just like any other function. One thing to keep in mind is that they may specify the data type of the arguments to be passed.
static extern class sys : stdlib.sys {
public extern getSysInfo();
public extern getAssemblyPath();
public extern getCurrentPath();
// ...
}
Aside from being external functions, these functions do not behave any differently from any other function. Extern classes can be extended, however you cannot inherit from multiple extern classes at this time.