Compare Revisions

Declaring and calling functions

Revision 32140:

Revision 32140 by Sheppy on

Revision 32141:

Revision 32141 by Joliclic on

Title:
Declaring and calling functions
Declaring and calling functions
Slug:
Mozilla/js-ctypes/Using_js-ctypes/Declaring_and_calling_functions
Mozilla/js-ctypes/Using_js-ctypes/Declaring_and_calling_functions
Tags:
JavaScript, js-ctypes
JavaScript, js-ctypes
Content:

Revision 32140
Revision 32141
n8      Functions are declared using the <a href="/en/js-ctypes/js-n8      Functions are declared using the <a href="/en/Mozilla/js-ct
>ctypes_reference/Library" title="en/js-ctypes/js-ctypes reference>ypes/js-ctypes_reference/Library" title="en/js-ctypes/js-ctypes r
>/Library"><code>Library</code></a> object's <a href="/en/js-ctype>eference/Library"><code>Library</code></a> object's <a href="/en/
>s/js-ctypes_reference/Library#declare%28%29" title="en/js-ctypes/>Mozilla/js-ctypes/js-ctypes_reference/Library#declare%28%29" titl
>js-ctypes reference/Library#declare()"><code>declare()</code></a>>e="en/js-ctypes/js-ctypes reference/Library#declare()"><code>decl
> method. Once declared, functions can be called using standard fu>are()</code></a> method. Once declared, functions can be called u
>nction syntax.>sing standard function syntax.
t34      For a more complete version of this example (including the t34      For a more complete version of this example (including the 
>implementation of the <code>struct_tm</code> type), see the <a hr>implementation of the <code>struct_tm</code> type), see the <a hr
>ef="/en/js-ctypes/Using_js-ctypes/Declaring_types#Field_descripto>ef="/en/Mozilla/js-ctypes/Using_js-ctypes/Declaring_types#Field_d
>rs" title="en/js-ctypes/Using js-ctypes/Declaring types#Field des>escriptors" title="en/js-ctypes/Using js-ctypes/Declaring types#F
>criptors">structures example</a>.>ield descriptors">structures example</a>.
35    </p>
36    <h2>
37      Returned values
38    </h2>
39    <p>
40      If the returnType can fit into a JS number without loss (al
 >l the numbers 32bits or smaller, as well as doubles and floats), 
 >then the function just return a JS number. For everything else it
 > returns a ctypes object representing the return value (including
 > 64-bit integers).

Back to History