develooper Front page | perl.perl6.users | Postings from December 2019

null and native call question

Thread Next
ToddAndMargo via perl6-users
December 27, 2019 12:06
null and native call question
Message ID:
Hi All,

      "As you may have predicted by now, a NULL pointer
      is represented by the type object of the struct type."

      LSTATUS RegQueryValueExW(
        HKEY    hKey,
        LPCWSTR lpValueName,
        LPDWORD lpReserved,
        LPDWORD lpType,
        LPBYTE  lpData,
        LPDWORD lpcbData

      This parameter is reserved and must be NULL.

With "native", how do I satisfy the "NULL" requirement?

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" returns:

     Cannot unbox a type object (int32) to int in method
     CALL-ME at C:\rakudo\share\perl6\sources \947BDAB9F96E0E5FCCB383124F9
     23A6BF6F8D76B (NativeCall) line 587

Many thanks,

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About