@yuuang/ffi-rs-linux-arm64-musl
Advanced tools
Comparing version 1.0.11 to 1.0.12
{ | ||
"name": "@yuuang/ffi-rs-linux-arm64-musl", | ||
"version": "1.0.11", | ||
"version": "1.0.12", | ||
"os": [ | ||
@@ -5,0 +5,0 @@ "linux" |
@@ -16,2 +16,8 @@ # ffi-rs | ||
## install | ||
```js | ||
$ npm i ffi-rs | ||
``` | ||
## Support type | ||
@@ -26,2 +32,3 @@ | ||
- i32Array | ||
- stringArray | ||
@@ -63,2 +70,9 @@ ## Usage | ||
extern "C" char **createArrayString(char **arr, int size) { | ||
char **vec = (char **)malloc((size) * sizeof(char *)); | ||
for (int i = 0; i < size; i++) { | ||
vec[i] = arr[i]; | ||
} | ||
return vec; | ||
} | ||
@@ -120,3 +134,3 @@ ``` | ||
let bigArr = new Array(100000).fill(100) | ||
equal(Math.max(bigArr), Math.max(load({ | ||
equal(bigArr[0], load({ | ||
library: dynamicLib, | ||
@@ -128,4 +142,12 @@ funcName: 'createArrayi32', | ||
retTypeLen: bigArr.length | ||
}))) | ||
})[0]) | ||
let stringArr = [c, c.repeat(200)] | ||
equal(stringArr[0], load({ | ||
library: dynamicLib, | ||
funcName: 'createArrayString', | ||
retType: RetType.StringArray, | ||
paramsType: [ParamsType.StringArray, ParamsType.I32], | ||
paramsValue: [stringArr, stringArr.length], | ||
retTypeLen: stringArr.length | ||
})[0]) | ||
``` |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
416176
149