343 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 - Archive

Welcome to the Ask Embedded Wizard archive. This community forum served us well for many years, but we've evolved our support approach!

Your resources:

The Embedded Wizard Online Documentation provides comprehensive documentation, tutorials, examples and ready-to-use software packages.

For dedicated assistance, explore our Embedded Wizard Product Support.

You can still browse the valuable discussions from our community history here.

Embedded Wizard Website | Privacy Policy | Imprint

...