我想离开
this code
到Perl6。当我可以打电话的时候
GetStdHandle
,
GetConsoleMode
和
SetConsoleMode
,当我尝试调用
ReadConsoleInput
:
Cannot locate symbol 'ReadConsoleInput' in native library 'Kernel32.dll'
in method setup at C:\rakudo\share\perl6\sources\947BDAB9F96E0E5FCCB383124F923A6BF6F8D76B (NativeCall) line 287
in method CALL-ME at C:\rakudo\share\perl6\sources\947BDAB9F96E0E5FCCB383124F923A6BF6F8D76B (NativeCall) line 576
in block <unit> at test.p6 line 149
现在,这个函数是
definitly there
. 不过,它有一个复杂的签名,我不确定我的脚本是否正确。这就是原因吗?NativeCall是否查看签名?
这是我在代码中定义子代码的方式(注释取自MS文档)
#BOOL WINAPI ReadConsoleInput( _In_ HANDLE hConsoleInput, _Out_ PINPUT_RECORD lpBuffer, _In_ DWORD nLength, _Out_ LPDWORD lpNumberOfEventsRead );
sub ReadConsoleInput(Pointer[void], INPUT_RECORD is rw, uint32, uint32 is rw) is native('Kernel32') returns Bool { * };
如果需要的话,我可以发布其余的代码,但是这是一个很大的样板文件,因为我必须定义所有的结构和内容,而这些通常来自头文件。