http://qs321.pair.com?node_id=1168732


in reply to Re^2: How to pass a pointer to an array of 'unsigned char' C data type with Win32::API ("U0")
in thread How to pass a pointer to an array of 'unsigned char' C data type with Win32::API

I don't see any reason for Perl to crash. But you don't even provide the error message associated with the Perl crash so we don't have much to go on to diagnose the problem.

- tye        

Replies are listed 'Best First'.
Re^4: How to pass a pointer to an array of 'unsigned char' C data type with Win32::API (error)
by apeks_okad (Novice) on Jul 28, 2016 at 15:52 UTC

    The error message is a windows error "Perl interpreter does not function anymore" (translated from the original German Error "Perl interpreter funktioniert nicht mehr"

        Wow..! That's quite a bit of research :). Those are exactly my reference documents.

        Yes, I am setting the value of the KSENT_TXInit as per the document (and getting an "all OK" return from the call) before calling the KSENT_TX function

        I wasn't so sure of the description in the document regarding the length of the information to be sent and hence contacted the developer of the DLL who replied saying that "the *data is a pointer to an array of unsigned chars were each char is a SENT nibble"

        So i tried quite a few possibilities in addition to the one mentioned in the original query

        passing only the 3 nibbles as 3 unsigned chars  my $data_ref = pack ('U0C*', 0x01,0x05,0x05);

        and passing the 3 nibbles in 2 octets

         my $data_ref = pack ('U0C*', 0x01,0x55);

        and passing all the 8 nibbles as 8 unsigned chars

        my $data_ref = pack ('U0C*', 0x08,0x01,0x05,0x05,0x00,0x00,0x0E,0x00);

        All of it still crashes with the same error. On hindsight, I think the correct windows error would be "Perl interpreter encountered an issue". I will try dumping the details of the failure if it helps further.