You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using fastcall to call a function in a DLL or SO writen in C, that depends of Operational System.
There is a function with this signature:
int GetVersion(char* v1, char* v2)
The result is 0 in case of success and a different value otherwise. The parameters v1 and v2 are outputs by value and maximum size is 64 chars. For example, if the result is 0, then v1 can be "201710.V2"and v2 a similar value. In other words, the value that I'm interested for will be writen into v1 and v2 pointer.
I'm mapping something like this:
const lib new Library(libraryPath)
.function({ getVersion: ['int', ['string', 'string']] });
And calling the code with:
console.log('checking', lib.isSymbolExists('GetVersion'));
var v1 = ref.allocCString(blankString(64)); // string with 64 positions
var v2 = ref.allocCString(blankString(64));
var rVersion = lib.interface.GetVersion(v1, v2);
console.log('\nResult on Call', rVersion);
console.log('v1', v1.toString());
console.log('v2', v2.toString());
The ouput is always:
checking true
Result on Call -1
v1
v2
My question is, how can I declare a const to be use as output parameter as example described at node-ffi tutorial.
I've already have the code that works with node-ffi. Now I'm trying to port it to fastcall.
The text was updated successfully, but these errors were encountered:
I'm not sure if there is there correct channel to ask about fastcall.
Anyway, I asked the same question on stackoverflow.
I'm using fastcall to call a function in a DLL or SO writen in
C
, that depends of Operational System.There is a function with this signature:
The result is 0 in case of success and a different value otherwise. The parameters
v1
andv2
are outputs by value and maximum size is 64 chars. For example, if the result is 0, thenv1
can be"201710.V2"
andv2
a similar value. In other words, the value that I'm interested for will be writen intov1
andv2
pointer.I'm mapping something like this:
And calling the code with:
The ouput is always:
My question is, how can I declare a const to be use as output parameter as example described at node-ffi tutorial.
I've already have the code that works with node-ffi. Now I'm trying to port it to fastcall.
The text was updated successfully, but these errors were encountered: