clarify returnType for ccall/cwrap; fixes #2705
This commit is contained in:
Родитель
2d7a7ec330
Коммит
0dafe7f5f7
|
@ -8,7 +8,7 @@ functions, accessing memory, converting pointers to JavaScript
|
|||
"Strings" and "Strings" to pointers (with different
|
||||
encodings/formats), and other convenience functions.
|
||||
|
||||
Note: All functions should be called though the "Module" object (for
|
||||
Note: All functions should be called though the *Module* object (for
|
||||
example: "Module.functionName"). At optimisation "-O2" (and higher)
|
||||
function names are minified by the closure compiler, and calling
|
||||
them directly will fail.
|
||||
|
@ -76,10 +76,13 @@ ccall(ident, returnType, argTypes, args)
|
|||
Arguments:
|
||||
* **ident** -- The name of the C function to be called.
|
||||
|
||||
* **returnType** -- The return type of the function. This will
|
||||
be one of the JavaScript types "number", "string" or "array"
|
||||
(use "number" for any C pointer, and "array" for JavaScript
|
||||
arrays and typed arrays; note that arrays are 8-bit).
|
||||
* **returnType** -- The return type of the function. This can
|
||||
be ""number"", ""string"" or ""array"", which correspond to
|
||||
the appropriate JavaScript types (use ""number"" for any C
|
||||
pointer, and ""array"" for JavaScript arrays and typed arrays;
|
||||
note that arrays are 8-bit), or for a void function it can be
|
||||
"null" (note: the JavaScript "null" value, not a string
|
||||
containing the word "null").
|
||||
|
||||
* **argTypes** -- An array of the types of arguments for the
|
||||
function (if there are no arguments, this can be omitted).
|
||||
|
|
|
@ -49,7 +49,7 @@ Calling compiled C functions from JavaScript
|
|||
|
||||
|
||||
:param ident: The name of the C function to be called.
|
||||
:param returnType: The return type of the function. This will be one of the JavaScript types ``number``, ``string`` or ``array`` (use ``number`` for any C pointer, and ``array`` for JavaScript arrays and typed arrays; note that arrays are 8-bit).
|
||||
:param returnType: The return type of the function. This can be ``"number"``, ``"string"`` or ``"array"``, which correspond to the appropriate JavaScript types (use ``"number"`` for any C pointer, and ``"array"`` for JavaScript arrays and typed arrays; note that arrays are 8-bit), or for a void function it can be ``null`` (note: the JavaScript ``null`` value, not a string containing the word "null").
|
||||
:param argTypes: An array of the types of arguments for the function (if there are no arguments, this can be omitted). Types are as in ``returnType``, except that ``array`` is not supported as there is no way for us to know the length of the array).
|
||||
:param args: An array of the arguments to the function, as native JavaScript values (as in ``returnType``). Note that string arguments will be stored on the stack (the JavaScript string will become a C string on the stack).
|
||||
:returns: The result of the function call as a native JavaScript value (as in ``returnType``).
|
||||
|
|
Загрузка…
Ссылка в новой задаче