For example, any value in haXe using the haXe String type is really an object instantiated from the
haXe String class. You may recall a discussion about this in Chapter 3 . Now, the String class does not
fully scale down to a string represented within the Neko Virtual Machine, but the string value that the
Neko Virtual Machine can see does exist within the haXe String object and can be extracted within an
untyped environment by accessing the property __s . It is this property that you need to pass to the
C/C++ function for processing, not the actual haXe String object. If you wanted to, you could extract
this manually, as in the following code:
var str = ???Hello, World!???
hello( untyped str.__s );
Not all base types in haXe that extend a class require data extraction, as they still manage to scale
correctly to the Neko Virtual Machine. However, it pays to stay on the safe side and subject all values
passed to C/C++ with the neko.Lib.haxeToNeko function. The values specifically requiring
restructuring are those of type String , and those of type Array .
Pages:
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039