avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] passing pointers to functions


From: John Myers
Subject: Re: [avr-gcc-list] passing pointers to functions
Date: Sat, 7 Nov 2009 12:21:50 -0800

It may be because ptr2func is not declared before the prototype. Try putting the typedef of ptr2func in the header file above the prototypes.

--John


On Sat, Nov 7, 2009 at 12:07 PM, don clay <address@hidden> wrote:
I have been having difficulty passing a function pointer in a function call.  In
researching the issue, it appears that there is a compiler issue with doing that &
I've tried a couple of suggested fixes with no luck.

Since the version appears to required in order to get the correct fix, my version
is gcc-4.3.0.

This is my last attempt.

1.  Here is the function prototype in the .h file

void InsertTask(ptr2func TaskPtr);                      // line 42 in atm328.h

2.  Here is the code in the single .c file containing all the code related to this
issue.

typedef void (*ptr2func)(void);

Here is the function

void InsertTask(ptr2func TaskPtr)

Here is the call

       InsertTask(LEDTask);


3. Here is the returned error.

../atm328.h:42: error: expected ')' before 'TaskPtr'


Before I try updating avr gcc, is there something else that I need to do in order
to make this work?

thanks.



_______________________________________________
AVR-GCC-list mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list


reply via email to

[Prev in Thread] Current Thread [Next in Thread]