SELIBRARY INTERFACE
A class needs to implement the SELibrary interface if any of its methods are to be used as wrapper functions. The object that implements this interface (and thus implements the actual wrapper functions) is passed to the seAddLibTable API call along with the corresponding library table. In addition to implementing the wrapper functions, this object could also be used to store any library specific data.
The SELibrary interface declares the following two methods:
public SELibrary seLibraryInitFunc(SEContext se);
public void seLibraryTermFunc(SEContext se);
The seLibraryInitFunc method is called whenever the corresponding library table is initialized. This method returns an object which contains any library specific data structure that the library may need access to. For example, the library may need to keep track of files opened. This method may create and return a new object, but you will most likely want to simply return this.
Note that the library can be initialized more than once, and you must be prepared to handle that case. The first time the library is initialized is when you call seAddLibTable, but the library will be reinitialized in certain circumstances.
The seLibraryTermFunc is used is called when the library is terminated. This function should be used to clean up any library specific resources. For each call to the initialization function, there will be one call to the termination function.