https://docs.perl6.org/language/nativecall
"As you may have predicted by now, a NULL pointer
is represented by the type object of the struct type."
https://learn.microsoft.com/en-us/windows/win32/api/winreg/nf-winreg-regqueryvalueexw
C++
LSTATUS RegQueryValueExW(
HKEY hKey,
LPCWSTR lpValueName,
LPDWORD lpReserved,
LPDWORD lpType,
LPBYTE lpData,
LPDWORD lpcbData
);
lpReserved
This parameter is reserved and must be NULL.
使用“native”技术,我该如何满足“NULL”要求?
constant WCHAR := uint16;
constant DWORD := int32;
sub RegQueryValueExW( DWORD, WCHARS, DWORD, DWORD, DWORD is rw, DWORD is rw ) is native("Kernel32.dll") returns DWORD { * };
$RtnCode = RegQueryValueExW( $Handle, $lpValueName, int32, REG_DWORD, $lpData, $lpcbData );
"int32" 的返回值:
非常感谢,-TCannot unbox a type object (int32) to int in method CALL-ME at C:\rakudo\share\perl6\sources \947BDAB9F96E0E5FCCB383124F9 23A6BF6F8D76B (NativeCall) line 587
int32
? - Håkon HæglandlpReserved
是一个DWORD *
而不仅仅是一个DWORD
? - Håkon Hægland0
吗?”)找到了解决方案,但是托德在发布并接受自己的答案之前回复说“传递零不起作用”,而他的答案却说“只需传递零。我犯了个小错误”。在我看来,应该有一个即时信号表明阅读这个问题很可能会浪费读者的时间。 - undefined