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

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

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

1,637 次查看
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
标签 (1)
标记 (1)
0 项奖励
回复
2 回复数

774 次查看
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 项奖励
回复

774 次查看
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 项奖励
回复