in reply to Re: Win32::API and pointer of dword
in thread Win32::API and pointer of dword

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

Replies are listed 'Best First'.
Re^3: Win32::API and pointer of dword
by ikegami (Patriarch) on Aug 18, 2009 at 15:14 UTC

    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

        So I guess it was the following unstated option: You misunderstood the purpose of the check. It isn't checking if the length is zero. It is checking if the pointer is NULL, for that would be a problem. Since we'll never pass NULL, the check will always be false, and that's a good thing.

Re^3: Win32::API and pointer of dword
by Anonymous Monk on Aug 18, 2009 at 14:56 UTC
    Show your code, not a description