You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 5649025
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: docs/integrating-external-libraries/defining-entry-points-for-direct-access.md
+46-20Lines changed: 46 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,62 +1,87 @@
1
1
# Defining entry points for direct access
2
2
3
-
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:
3
+
A library to be loaded and accessed directly through an [ExternalObject instance](./externalobject-object.md) must publish the following entry points.
4
+
5
+
!!! note
6
+
These must be exported as C functions, not C++ functions
4
7
5
8
---
6
9
7
10
## Entry Points
8
11
9
-
The following entry points are required if you wish to use an ExternalObject instance:
12
+
The following entry points are required if you wish to use an [ExternalObject instance](./externalobject-object.md):
10
13
11
14
### ESInitialize()
12
15
13
16
`char* ESInitialize (TaggedData* argv, long argc);`
14
17
15
-
|`argv, argc`| The pointer to and number of arguments passed to the constructor,<br/>in the form of TaggedData. |
|`argv, argc`| The pointer to and number of arguments passed to the constructor, in the form of TaggedData. |
27
+
28
+
#### Returns
29
+
30
+
A string of function signatures; see [Library initialization](#library-initialization).
21
31
22
32
---
23
33
24
34
### ESGetVersion()
25
35
26
36
`long ESGetVersion (void );`
27
37
38
+
#### Description
39
+
28
40
Takes no arguments, and returns a version number for the library as a long integer.
29
41
30
42
The result is available in JavaScript as ExternalObject.version.
31
43
44
+
#### Returns
45
+
46
+
Long integer
47
+
32
48
---
33
49
34
50
### ESFreeMem()
35
51
36
52
`void ESFreeMem (void* p);`
37
53
38
-
|`p`| A pointer to the string. |
39
-
|-------|----------------------------|
54
+
#### Description
40
55
41
56
Called to free memory allocated for a null-terminated string passed to or from library functions.
42
57
43
-
Returns nothing.
58
+
| Parameter | Description |
59
+
| --------- | ------------------------ |
60
+
|`p`| A pointer to the string. |
61
+
62
+
#### Returns
63
+
64
+
Nothing
44
65
45
66
---
46
67
47
68
### ESTerminate()
48
69
49
70
`void ESTerminate (void );`
50
71
72
+
#### Description
73
+
51
74
Called when your library is being unloaded. See [Library termination](#library-termination).
52
75
53
-
Takes no arguments, and returns nothing.
76
+
#### Returns
77
+
78
+
Nothing
54
79
55
80
---
56
81
57
82
## Additional functions
58
83
59
-
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.
84
+
The shared library can contain any number of additional functions. Each function corresponds to a JavaScript method in the [ExternalObject instance](./externalobject-object.md). If a function is undefined, ExtendScript throws a run-time error.
60
85
61
86
Each function must accept the following arguments:
62
87
@@ -67,9 +92,9 @@ Each function must accept the following arguments:
67
92
The variant data does not support JavaScript objects. The following data types are allowed:
68
93
69
94
-`undefined`
70
-
-`Boolean`
95
+
- Boolean
71
96
-`double`
72
-
-`string` - Must be UTF-8 encoded. The library must define an entry point [ESFreeMem()](#externalobject-functions-esfreemem), which ExtendScript calls to release a returned string pointer. If this entry point is missing, ExtendScript does not attempt to release any returned string data.
97
+
-String - Must be UTF-8 encoded. The library must define an entry point [ESFreeMem()](#externalobject-functions-esfreemem), which ExtendScript calls to release a returned string pointer. If this entry point is missing, ExtendScript does not attempt to release any returned string data.
73
98
-`Script` - A string to be evaluated by ExtendScript. Use to return small JavaScript scripts that define arbitrarily complex data.
74
99
75
100
If, when a function is invoked, a supplied parameter is undefined, ExtendScript sets the data type to `undefined` and does not attempt to convert the data to the requested type.
@@ -101,13 +126,14 @@ For each function, the string begins with the function name, followed by an unde
101
126
102
127
The characters that indicate data types are:
103
128
104
-
| a | Any type. The argument is not converted. This is the default, if no type is supplied or if a type<br/>code is unrecognized. |
0 commit comments