I need to load a dll file with js-ctypes code. Here is header code in dll
typedef unsigned char BYTE;
extern "C" __declspec(dllexport) BYTE* foo(BYTE* a, const char* b);
And then, i load it with js-ctypes code:
var foo = lib.declare("foo", ctypes.default_abi, ctypes.unsigned_char.ptr, ctypes.unsigned_char.ptr, ctypes.char.ptr);
And when i called this function, i got an error
var a = ctypes.unsigned_char.ptr("a");
var b = ctypes.char.ptr("b");
var result = foo(a, b);
TypeError: can't convert the string "a" to the type ctypes.unsigned_char.ptr
Can anybody help me to solve this?
Your declare is correct. But to call it you should do it like this: