Prev | Current Page 1043 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"


When creating an Array to return to Neko, you use the alloc_array function, which accepts an integer
value depicting the number of items you can store in the Array. Once set, this cannot be changed, so any
re - dimensioning requirements will force you to copy the Arrays stored values into a new Array set to the
appropriate size.
Part III: Extending the Possibilities
568
Remember that a Neko Array can only contain value items. You probably think this sounds obvious, but
when dealing with data in C/C++, you may forget to wrap data into a value before storing in an Array,
which can lead to hair pulling until you realize the simple mistake.
As with haXe strings, the haXe Array also requires that the actual array data be extracted from a field
of the Array object before using it in C/C++. In this instance, the field containing the array data is
called __a . To extract the data, simply perform the process of extracting data from the field __a of the
object Array .
Functions
As with anything else, pointers to functions can also exist as value types in the C/C++ layer.


Pages:
1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055