Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pointer to an array, I get only the first element #70

Open
amaccis opened this issue Jan 30, 2022 · 1 comment
Open

Pointer to an array, I get only the first element #70

amaccis opened this issue Jan 30, 2022 · 1 comment

Comments

@amaccis
Copy link

amaccis commented Jan 30, 2022

Hi all!
I don't know if it's a real issue, but I can't find the answer to my question.

I have a pointer to a pointer to an array
const char ** myfunc(void)

so using ffi-napi and ref-napi I can write something like that

import * as ffi from 'ffi-napi';
import * as ref from 'ref-napi';

let mylib = ffi.Library('mylib', {
    "myfunc": [ ref.refType('char'), [] ],
});

let myFunc = mylib.myfunc()
let firstItem = ref.readCString(ref.readPointer(myFunc), 0);

but I can retrieve only the first element of the array.
Is there a way to retrieve all the items?
Thanks!

@weskerfoot
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants