Skip to content

Commit

Permalink
feat: support struct array
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangyuang committed Dec 23, 2024
1 parent 5c38db9 commit efffd8d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
8 changes: 4 additions & 4 deletions cpp/sum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,16 +256,16 @@ typedef struct
MINUTIA item[3];
} MINUTIAE;

extern "C" MINUTIAE *printAndReturnMinutiae(MINUTIAE minutiae)
extern "C" MINUTIAE *printAndReturnMinutiae(MINUTIAE *minutiae)
{

MINUTIAE *result = new MINUTIAE;
result->nNumber = minutiae.nNumber;
printf("nNumber=%d\n", minutiae.nNumber);
result->nNumber = minutiae->nNumber;
printf("nNumber=%d\n", minutiae->nNumber);

for (int i = 0; i < result->nNumber; i++)
{
result->item[i] = minutiae.item[i];
result->item[i] = minutiae->item[i];
printf("Result item[%d]: x=%d, y=%d, dir=%d, kind=%d\n",
i, result->item[i].x, result->item[i].y,
result->item[i].dir, (int)result->item[i].kind);
Expand Down
3 changes: 1 addition & 2 deletions tests/struct.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export const testObject = () => {
ffiTypeTag: DataType.StackStruct
},
length: 3
})
}),
},
paramsType: [{
nNumber: DataType.I16,
Expand All @@ -107,7 +107,6 @@ export const testObject = () => {
},
length: 3
}),
ffiTypeTag: DataType.StackStruct
}],
paramsValue: [{
nNumber: 3,
Expand Down

0 comments on commit efffd8d

Please sign in to comment.