Restructuring Data in ha X e from C/C++
Just as you have to prepare data to leave haXe for a C/C++ library, you are also required to restructure
data returned from C/C++. This is done, surprisingly, using the neko.Lib.nekoToHaxe function.
Again, this is not strictly necessary for all data types returned from the C/C++ code, though it often pays
to be cautious and prepare all returned code. As with values passed to the C/C++ code, the values
specifically requiring restructuring are those of type String , and those of type Array .
Neko Type Checking in C/C++
One part of the HelloWorld example that has not yet been discussed is the line:
val_check( str, string );
This line of code provides the type checking of the passed str parameter.
Working in an environment where all function parameters are not checked at compile time is a
dangerous situation to find yourself in. The problem is that, should a value ??™ s type not be what you
expect, you could possibly crash the virtual machine altogether. This becomes especially precarious
should your Neko Virtual Machine be functioning as an extension to web server software on a shared
host machine, as any lack of safe data management will also affect other server users.
Pages:
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040