![]() |
|
laziness, impatience, and hubris | |
PerlMonks |
How to pass a pointer to an array of 'unsigned char' C data type with Win32::APIby apeks_okad (Novice) |
on Jul 27, 2016 at 16:00 UTC ( [id://1168655]=perlquestion: print w/replies, xml ) | Need Help?? |
apeks_okad has asked for the wisdom of the Perl Monks concerning the following question:
Dear Perl Monks,
I need a help in Win32::API
I am working on a hardware test automation, The interface to hardware is Automotive Interface 4 (AI4 : USB to SENT) and the H/W manufacturer has provided a C DLL which exports set of functions to communicate with the hardware. I am trying to import the C DLL via Win32::API module so i can automate the communication via perl. I have a problem with one API ,KSENT_TX. This function requires a pointer to an array of unsigned char as one of its arguments. The header file extern declarations(provided by the manufacturer) looks as follows: MOD_EXTERN unsigned char _stdcall KSENT_TX(unsigned char channel, unsigned char *data, unsigned long cyclic);I have problems passing the right values to this function. Perl.exe crashes every time I try executing my code.
I tried various methods to pass the array reference my $data_ref = [0x81 , 0x55, 0x00, 0xE0];or
also my $data_ref = pack ('C*', (0x81 , 0x55, 0x00, 0xE0));All of it leads to the same PERL crash. I am a novice to PERL development so maybe I am missing something really basic here. Can you please help me with this problem
Back to
Seekers of Perl Wisdom
|
|