|Perl Monk, Perl Meditation|
Solved: How to use 'unsigned char' C data type with Win32::APIby sam_bakki (Pilgrim)
|on Mar 12, 2012 at 11:55 UTC||Need Help??|
sam_bakki 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 USB-I2C and we have a C DLL which exports set of functions to communicate with hardware.
I am trying to import the C DLL via Win32::API module so i can automate some test cases via perl. Right now, I could able to read & write to particular memory address using the exported APIs in DLL
I have a problem with one API , Which is i2cGetDeviceAddress , it returns unsigned char. I could not able to properly use Win32::API to get the data from this API. This API is working well in C code
I have given API prototype in C , C code and its output and my perl code
Please help me to use 'unsigned char' with Win32::API module.
UPDATE: Problem is solved
The above code itself is fine. I was confused with API call sequence. When I call I2CWrite API and then i2cGetDeviceAddress , It is providing correct output (i.e 70)
Thanks a Lot to BrowserUk his suggestion was useful to me to implement some other API using Win32::API
Thanks to tye for the $ret &= 0xFF; tip. I did not know this, That is why i am using complex pack & unpack