@yuuang/ffi-rs-linux-arm64-musl
Advanced tools
Comparing version 1.0.32 to 1.0.33
{ | ||
"name": "@yuuang/ffi-rs-linux-arm64-musl", | ||
"version": "1.0.32", | ||
"version": "1.0.33", | ||
"os": [ | ||
@@ -5,0 +5,0 @@ "linux" |
@@ -47,2 +47,3 @@ # ffi-rs | ||
- [string](#basic-types) | ||
- [u8](#basic-types) | ||
- [i32](#basic-types) | ||
@@ -56,2 +57,3 @@ - [i64](#basic-types) | ||
- [u8Array](#array) | ||
- [i32Array](#array) | ||
@@ -266,4 +268,6 @@ - [stringArray](#array) | ||
bool boolFalse; | ||
int64_t longVal; | ||
char byte; | ||
char *byteArray; | ||
} Person; | ||
extern "C" Person *getStruct(Person *person) { | ||
@@ -277,6 +281,5 @@ return person; | ||
// Allocate and initialize doubleArray | ||
person->doubleArray = (double *)malloc(sizeof(double) * 3); | ||
person->doubleArray[0] = 1.1; | ||
person->doubleArray[1] = 2.2; | ||
person->doubleArray[2] = 3.3; | ||
double initDoubleArray[] = {1.1, 2.2, 3.3}; | ||
person->doubleArray = (double *)malloc(sizeof(initDoubleArray)); | ||
memcpy(person->doubleArray, initDoubleArray, sizeof(initDoubleArray)); | ||
@@ -286,2 +289,3 @@ // Initialize age and doubleProps | ||
person->doubleProps = 1.1; | ||
person->byte = 'A'; | ||
@@ -291,32 +295,48 @@ // Allocate and initialize name | ||
person->stringArray = (char **)malloc(sizeof(char *) * 1); | ||
person->stringArray[0] = strdup("tom"); | ||
char *stringArray[] = {strdup("tom")}; | ||
person->stringArray = (char **)malloc(sizeof(stringArray)); | ||
memcpy(person->stringArray, stringArray, sizeof(stringArray)); | ||
person->i32Array = (int *)malloc(sizeof(int) * 4); | ||
person->i32Array[0] = 1; | ||
person->i32Array[1] = 2; | ||
person->i32Array[2] = 3; | ||
person->i32Array[3] = 4; | ||
// Allocate and initialize byteArray | ||
char initByteArray[] = {101, 102}; | ||
person->byteArray = (char *)malloc(sizeof(initByteArray)); | ||
memcpy(person->byteArray, initByteArray, sizeof(initByteArray)); | ||
int initI32Array[] = {1, 2, 3, 4}; | ||
person->i32Array = (int *)malloc(sizeof(initI32Array)); | ||
memcpy(person->i32Array, initI32Array, sizeof(initI32Array)); | ||
person->boolTrue = true; | ||
person->boolFalse = false; | ||
person->longVal = 4294967296; | ||
// Allocate and initialize parent | ||
person->parent = (Person *)malloc(sizeof(Person)); | ||
person->parent->doubleArray = (double *)malloc(sizeof(double) * 3); | ||
person->parent->doubleArray[0] = 1.1; | ||
person->parent->doubleArray[1] = 2.2; | ||
person->parent->doubleArray[2] = 3.3; | ||
double parentDoubleArray[] = {1.1, 2.2, 3.3}; | ||
person->parent->doubleArray = (double *)malloc(sizeof(parentDoubleArray)); | ||
memcpy(person->parent->doubleArray, parentDoubleArray, | ||
sizeof(parentDoubleArray)); | ||
person->parent->age = 43; | ||
person->parent->doubleProps = 3.3; | ||
person->parent->name = strdup("tom father"); | ||
person->parent->stringArray = (char **)malloc(sizeof(char *) * 2); | ||
person->parent->stringArray[0] = strdup("tom"); | ||
person->parent->stringArray[1] = strdup("father"); | ||
person->parent->i32Array = (int *)malloc(sizeof(int) * 3); | ||
person->parent->i32Array[0] = 5; | ||
person->parent->i32Array[1] = 6; | ||
person->parent->i32Array[2] = 7; | ||
char *pstringArray[] = {strdup("tom"), strdup("father")}; | ||
person->parent->stringArray = (char **)malloc(sizeof(pstringArray)); | ||
memcpy(person->parent->stringArray, pstringArray, sizeof(pstringArray)); | ||
int parentI32Array[] = {5, 6, 7}; | ||
person->parent->i32Array = (int *)malloc(sizeof(parentI32Array)); | ||
memcpy(person->parent->i32Array, parentI32Array, sizeof(parentI32Array)); | ||
person->parent->boolTrue = true; | ||
person->parent->boolFalse = false; | ||
person->parent->longVal = 5294967296; | ||
person->parent->byte = 'B'; | ||
char parentByteArray[] = {103, 104}; | ||
person->parent->byteArray = (char *)malloc(sizeof(parentByteArray)); | ||
memcpy(person->parent->byteArray, parentByteArray, sizeof(parentByteArray)); | ||
return person; | ||
@@ -337,2 +357,5 @@ } | ||
boolFalse: false, | ||
longVal: 5294967296, | ||
byte: 66, | ||
byteArray: [103, 104], | ||
}; | ||
@@ -349,2 +372,5 @@ const person = { | ||
boolFalse: false, | ||
longVal: 4294967296, | ||
byte: 65, | ||
byteArray: [101, 102], | ||
}; | ||
@@ -370,2 +396,8 @@ const parentType = { | ||
boolFalse: DataType.Boolean, | ||
longVal: DataType.I64, | ||
byte: DataType.U8, | ||
byteArray: arrayConstructor({ | ||
type: DataType.U8Array, | ||
length: parent.byteArray.length, | ||
}), | ||
}; | ||
@@ -391,2 +423,8 @@ const personType = { | ||
boolFalse: DataType.Boolean, | ||
longVal: DataType.I64, | ||
byte: DataType.U8, | ||
byteArray: arrayConstructor({ | ||
type: DataType.U8Array, | ||
length: person.byteArray.length, | ||
}), | ||
}; | ||
@@ -411,2 +449,5 @@ const personObj = load({ | ||
boolFalse: DataType.Boolean, | ||
longVal: DataType.I64, | ||
byte: DataType.U8, | ||
byteArray: DataType.U8Array, | ||
}, | ||
@@ -419,2 +460,5 @@ doubleProps: DataType.Double, | ||
boolFalse: DataType.Boolean, | ||
longVal: DataType.I64, | ||
byte: DataType.U8, | ||
byteArray: DataType.U8Array, | ||
}, | ||
@@ -421,0 +465,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
607083
545