Koromix/koffi

Structure parameter, cannot get an assignment

Closed this issue · 3 comments

I have a c++ DLL that has a method as follows:
long __stdcall Get_TermbData(char *szFileNameIn, TERMB_ITEM* pstOut)
TERMB_ITEM structure is defined as follows:
struct TERMB_ITEM { char pzTxt[70][128]; };

How do I get pstOut:
const Get_TermbData = IDR_A2.func('long __stdcall Get_TermbData(char *szFileNameIn, TERMB_ITEM* pstOut)'); const pstOut = { }; device_result = Get_TermbData(path.join(process.resourcesPath, 'plugins/aaa.bmp'), pstOut);
post-execution the pstOut is empty

Annotate the parameter as "output", as documented here: https://koffi.dev/output

const Get_TermbData = IDR_A2.func('long __stdcall Get_TermbData(char *szFileNameIn, _Out_ TERMB_ITEM* pstOut)');

const pstOut = { };
device_result = Get_TermbData(path.join(process.resourcesPath, 'plugins/aaa.bmp'), pstOut);

Thanks, I got the "psout" value,but "pzTxt" are there any chinese characters in this content ,cannot be displayed properly

struct TERMB_ITEM { char pzTxt[70][128] };
pzTxt.length is 128?why?