in reply to Win32::API and pointer of dword

I think the following would do:

my $CheckLen = Win32::API->new('...', 'CheckLen', 'P', 'V') or die ...; sub CheckLen { $len = pack('L', $_[0]); $CheckLen->Call($len); $_[0] = unpack('L', $len); }

Of course, you could also try the prototype method of loading your function.

Replies are listed 'Best First'.
Re^2: Win32::API and pointer of dword
by cbrauner (Novice) on Aug 18, 2009 at 14:44 UTC
    yea i tried this wiwth pack/unpack the only issue i have is with initialisation of len=0 : in my c function i have a check: if len==0 return ERROR, but this doesnt get called ..? thx

    GrandFather restored original content

Re^2: Win32::API and pointer of dword
by cbrauner (Novice) on Aug 18, 2009 at 14:45 UTC
    yea i tried this with pack/unpack the only issue i have is with initialisation of len=0 : in my c function i have a check: if len==0 return ERROR, but this doesnt get called ..? thx

    GrandFather restored original content

      len is will never be NULL pointer. It'll never be zero. If you want the ability to pass NULL, we'll have to do more work. Which of the following is true?

      • Did you mean to allow NULL to be passed?
      • Did you forget to dereference len?
      • Was choosing to pass a pointer a mistake?

      And then there's return ERROR; in a function of return type void...

        found it in c-code : check is against pointer and not against the value - third party dll ;) - thx
      Show your code, not a description