This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

indirect call

Hello

I have a function like this :

static int yaffs_WriteChunkToNAND(struct yaffs_DeviceStruct *dev,int chunkInNAND, const __u8 *data, yaffs_Spare *spare)
{
        .
         .
         .
return dev->writeChunkToNAN(dev,chunkInNAND ,data,spare);
}

dev is a struct like this:

struct yaffs_DeviceStruct
{
int   nBytesPerChunk;
int (*writeChunkToNAND)(struct yaffs_DeviceStruct *dev,int chunkInNAND, const __u8 *data, yaffs_Spare *spare);
int (*readChunkFromNAND)(struct yaffs_DeviceStruct *dev,int chunkInNAND, __u8 *_data, yaffs_Spare *spare);

but when compile this code, there is an error like this:
indirect call: parameters do not fit within registers.

What is couse of thiss error and what is solution?

Parents
  • the simple way would be to drop the function pointer and replace it with
    if (xxx) hhh();

    if you absolutely have to make the compiler try to do something the architecture was never intended for, then, instead of passing some/one of the parameters store itthem in (a) global variables.

    i personally, would never do anyrthing but the first suggestion.

    Erik

Reply
  • the simple way would be to drop the function pointer and replace it with
    if (xxx) hhh();

    if you absolutely have to make the compiler try to do something the architecture was never intended for, then, instead of passing some/one of the parameters store itthem in (a) global variables.

    i personally, would never do anyrthing but the first suggestion.

    Erik

Children