C23000: Argument(s) too complex for function pointer call

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

C23000: Argument(s) too complex for function pointer call

1,178 Views
nonarKitten
Contributor II

I have NEVER seen this error and haven't a clue how to fix it at the moment. I was writting a simple multithreading core for our RS08-based board, and it suddenly started throwing this error. I've tried simple things like rebooting, etc, to no avail.

 

In threading.h

typedef struct {  unsigned short lc;               // current line of the thread  unsigned char rc;                // return condition  char (*fn)(struct __thread *pt); // pointer to the function} __thread;

Then in main.c

 

extern char ISR_RTI(__thread *pt);//...static __thread thread[] = {  { 0, 0, ISR_RTI },  // real-timer interrupt handler
  //...};void main(void) {  static unsigned char current_thread;  //...  thread[current_thread].rc = thread[current_thread].fn(&thread[current_thread]);}

Red indicates the line the error happens on. 

 

 

The funny thing is that it was compiling at one point. I know I changed something and lost track of what I changed and can't seem to get it back into a working state. Any help would be greatly appreciated. Thanks in advance!
Message Edited by nonarKitten on 2009-04-02 11:50 PM
Labels (1)
Tags (1)
0 Kudos
2 Replies

315 Views
Lundin
Senior Contributor IV
typedef struct {
unsigned short lc; // current line of the thread
unsigned char rc; // return condition
char (*fn)(struct __thread *pt); // pointer to the function
} __thread;


Just a wild guess:

You had something like this, but it wouldn't work because of linkage:

char (*fn)(__thread *pt);

The __thread identifier is unknown at that point. So maybe you changed to struct?
Try this and see if it solves anything:

typedef struct __thr {
unsigned short lc; // current line of the thread
unsigned char rc; // return condition
char (*fn)(struct __thr *pt); // pointer to the function
} __thread;


Another guess: meddling with the memory sizes would make function pointers a different width. You could try this non-standard code and see if it helps:

char (* near fn)(struct __thr *pt)
0 Kudos

315 Views
CompilerGuru
NXP Employee
NXP Employee

Multi threading with a RS08? Interesting.

As the RS08 does not have a stack, the compiler allows to pass only 8 bit arguments (in A)

via function pointers.

Could it be that the pt argument was added? Or could it be that the memory model has changed?

In one memory model (don't even remember the name, but the one I would use usually) plain pointers

are 8 bits. In the other one, they are 16 bits and a single pointer argument would therefore not

be possible with a function pointer call.

 

Daniel

0 Kudos