Loading...
Searching...
No Matches
Import functions

Importing functions is a form of sharing code between script modules. Unlike the `shared` keyword though, the `import` requires specific code in the application to bind the imported functions after the script has been compiled.

This may be useful when the application wants to control specifically what can and cannot be imported.

To bind all the imported functions, without any specific treatment, the application just needs to call the BindAllImportedFunctions method after the build has completed.

If fine grained control is desired, then the application should use the methods GetImportedFunctionCount, GetImportedFunctionDeclaration, GetImportedFunctionSourceModule, GetFunctionByDecl, and BindImportedFunction, to enumerate and bind the imported functions one by one, and raise an error in case the script tries to import a function that the application doesn't allow.

Another advantage that the import function feature has over shared entities, is that the imported functions can be unbound and then bound to another script module if there is a need to change the sourcing module. To unbind the bound functions use the methods UnbindAllImportedFunctions or UnbindImportedFunction.