doc/cpp/ffi
Differences between version #8185 and #8186
27c27 < One of the main differences between neko CFFI and C++ CFFI is how arrays are treated. --- > One of the differences between neko CFFI and C++ CFFI is how arrays are treated. The neko implementation of arrays naturally allows it to provide and "value *" - pointer to series of elements. However, this is only available on a C++ executable if the array is an array of Dynamic. If the array is an array of Int, Bool or Double, then it may be possible to get an array of "double *" etc, which is a very efficient way of accessing the data (it is not possible to access stringl like this). To write efficient code, your ndll should try the val_array_value function (if you are loaded in neko), then one or more of the specific array functions (eg, val_array_double if your haxe code takes an Array<Float>), before falling back to val_array_i if the other options are not available. 28a29,32 > ===== Byte Access ===== > > Neko uses "strings" as byte buffers, whereas C++ uses "Array of unsigned char", since its native string representation is an immutable string of wchar_t. To access the data as a byte-buffer, you must first use "val_to_buffer" to convert the value handle to a buffer handle. Using this, you can then call the various buffer manipulation functions. The different type of handle ensures type checking at compile time. >
| Ver | Date | Lg | User | Action |
|---|---|---|---|---|
| #15144 | 2012-07-21 20:05:21 | en | jan_flanders | View | Diff |
| #15143 | 2012-07-21 20:03:42 | en | jan_flanders | View | Diff |
| #9172 | 2010-09-03 02:37:32 | en | Conrad | View | Diff |
| #9149 | 2010-08-28 20:22:22 | en | Conrad | View | Diff |
| #9148 | 2010-08-28 20:15:00 | en | Conrad | View | Diff |
| #8189 | 2010-03-08 07:48:30 | en | gamehaxe | View | Diff |
| #8188 | 2010-03-08 07:38:06 | en | gamehaxe | View | Diff |
| #8187 | 2010-03-08 07:24:10 | en | gamehaxe | View | Diff |
| #8186 | 2010-03-08 07:11:29 | en | gamehaxe | View | Diff |
| #8185 | 2010-03-08 06:21:32 | en | gamehaxe | View | Diff |
| #8184 | 2010-03-08 06:08:54 | en | gamehaxe | View | Diff |
| #8183 | 2010-03-08 05:52:21 | en | gamehaxe | View | Diff |
| #8181 | 2010-03-05 06:40:30 | en | gamehaxe | View | Diff |
| #8180 | 2010-03-05 06:22:14 | en | gamehaxe | View | Diff |
| #8179 | 2010-03-05 06:22:14 | en | gamehaxe | Set title to C Foreign Function Interface |
Previous | Next