You specify the name of the library in the constructor. The constructor searches for the named library using the paths defined in the static property ExternalObject.searchFolders.
If you are having difficulty loading your library as an ExternalObject, set the property
true, then call
ExternalObject.search('lib:myLibrary'). This function
performs the search, and the log reports the paths that have been searched to the ExtendScript Toolkit
Before loading the library, the current folder is temporarily switched to the location of the found executable file.
- In Mac OS, the current directory is set to the bundle or framework folder for the library.
- In Windows and UNIX, the current directory is set to the folder that contains the library.
obj = new ExternalObject ("lib:" + filespec, arg1, ...argn);
The specifier “lib:” is case sensitive, and serves as the marker for dynamic libraries. Concatenate this to the base name of the shared library, with or without an extension. ExtendScript appends a file extension if necessary, according to the operating system:
The name of the library is case sensitive in UNIX.
||Optional. Any number of arguments to pass to the library’s initialization routine.|
var mylib = new ExternalObject( "lib:myLibrary" );
ExternalObject class properties¶
The ExternalObject class provides these static properties:
A set of alternate paths in which to search for the shared library files, a single string with multiple path specifications delimited by semicolons (;). Paths can be absolute or relative to the Folder.startup location. Default value is:
|version||Number||The version of the library, as returned by ESGetVersion().|
ExternalObject class function¶
The ExternalObject class provides this static function to help debug problems with loading libraries as external objects:
||String. The file specification for the compiled library, with or without path information.|
true if the library is found,
ExternalObject instance function¶
Explicitly shuts down the
ExternalObject dynamic library wrapped by this instance.
It can be helpful to force a shutdown of the external library if termination of external libraries during the shutdown of the hosting application does not occur in the correct order.