
CHAPTER 7: Integrating External Libraries Defining entry points for direct access 203
Defining entry points for direct access
A library to be loaded and accessed directly through an ExternalObject instance must publish the
following entry points. These must be exported as C functions, not C++ functions:
Additional functions
The shared library can contain any number of additional functions. Each function corresponds to a
JavaScript method in the
ExternalObject instance. If a function is undefined, ExtendScript throws a
run-time error.
Each function must accept the following arguments:
X An array of TaggedData.
X An argument count.
X A variant data structure that takes the return value.
The variant data does not support JavaScript objects. The following data types are allowed:
X undefined
X Boolean
X double
ESInitialize()
char* ESInitialize (TaggedData* argv, long argc);
argv, argc
The pointer to and number of arguments passed to the constructor, in the form of
TaggedData
.
Called when your library is loaded into memory.
Returns a string of function signatures; see “
Library initialization” on page 204.
ESGetVersion()
long ESGetVersion (void );
Takes no arguments, and returns a version number for the library as a long integer. The result is
available in JavaScript as
ExternalObject.version.
ESFreeMem()
void ESFreeMem (void* p);
p
A pointer to the string.
Called to free memory allocated for a
null-terminated string passed to or from library functions.
Returns nothing.
ESTerminate()
void ESTerminate (void );
Called when your library is being unloaded. See “Library termination” on page 205.
Takes no arguments, and returns nothing.
Kommentare zu diesen Handbüchern