63 views
in GUI Development by

Hi!

I've a native function to call a device side API which expects an array as an argument. Sample code as follows:

var uint32 NoOfDataLogToDelete = 100;
array uint32 DataLogNum[1] ;
DataLogNum[0] = 0;


$if !$prototyper
    native (DataLogNum, NoOfDataLogToDelete )
    {
  DataLogDeleteByLogNumbers(DataLogNum, NoOfDataLogToDelete) ;
  }
$endif

When I do like this, I'm getting a compilation warning as follows:

 incompatible pointer types passing 'XUInt32[1]' (aka 'unsigned long[1]') to parameter of type 'uint32_t *' (aka 'unsigned int *') [-Wincompatible-pointer-types]

Even though embedded wizard side variable and Device side variable are same data types (uint32) it gives warming. Now my question is Can I pass Embedded wizard array to Device side API as an argument? What mistake I'm making here? 

Thank you

 

1 Answer

0 votes
by

Hello ThanushiyahG,

XUInt32 and uint32_t are from technical point of view equal. Both represent 32-bit unsigned integer values. You can add typecast to suppress the compiler warning, for example: 

DataLogDeleteByLogNumbers((uint32_t*)DataLogNum, NoOfDataLogToDelete) ;

Please note possible error source in your implementation: NoOfDataLogToDelete is 100, the array stores however 1 entry only. I don't know what the function DataLogDeleteByLogNumbers() does. But it seems to expect the DataLogNum to have as many entries as specified in the second parameter.

Best regards

Paul Banach

by
Hi!

Yes. Type casting eliminated that warning. Thanks a lot for your advice.

Thanushiyah

Ask Embedded Wizard

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint

...