use Win32::API; #C proptype # typedef unsigned char __stdcall i2cGetDeviceAddress_type(); # extern i2cGetDeviceAddress_type *i2cGetDeviceAddress; #C++ Prototype # extern "C" Byte __stdcall i2cGetDeviceAddress(void); # C Code # printf ("\n \n DEV: %d , %c , %x ", i2cGetDeviceAddress(),i2cGetDeviceAddress(),i2cGetDeviceAddress()); # # Output: DEV: 70 , F , 46 #Perl Code # When i use 'char' as a return type , API is not returning anything # my $i2cGetDeviceAddressFunc = Win32::API->new('CrdI2C32', 'char i2cGetDeviceAddress()') or warn "\n ERROR: Can not import API:i2cGetDeviceAddress , $^E ,"; # When i use 'unsigned char' as a return type, I get, Win32::API::parse_prototype: WARNING unknown output parameter type 'unsigned' #my $i2cGetDeviceAddressFunc = Win32::API->new('CrdI2C32', 'unsigned char i2cGetDeviceAddress()') or warn "\n ERROR: Can not import API:i2cGetDeviceAddress , $^E ,"; # So, I used INT , The following way is working for some other API but not this API :( my $i2cGetDeviceAddressFunc = Win32::API->new('CrdI2C32', 'INT i2cGetDeviceAddress()') or warn "\n ERROR: Can not import API:i2cGetDeviceAddress , $^E ,"; my $ret = 0; $ret = $i2cGetDeviceAddressFunc->Call(); $ret = unpack ('C*',pack ("i",$ret)); print "\n $ret "; # prints 152 $ret = sprintf ("0x%X",$ret); print "\n $ret"; #prints 0x98 but i wanted 0x46