| View previous topic :: View next topic |
| Author |
Message |
JD Guest
|
Posted: Tue Mar 22, 2005 5:32 am Post subject: Pointers to functions |
|
|
I want to build a list of pointers to functions but I can't
resolve the compiler errors:
AddFunction( &FunctionName );
The above produces two errors:
Cannot convert 'void (_fastcall * (_closure )(AParam &))(AParam &)'
to 'void (_fastcall * (_closure *)(AParam &) *)(AParm &)'
Type mismatch in parameter 1
wanted 'void (_fastcall * (_closure *)(AParam &) *)(AParam &)',
got 'void (_fastcall * (_closure )(AParam &))(AParam &)'
typedef void __fastcall (__closure *Function)( AParam& );
void AddFunction( TFunction Function )
{
if( List->IndexOf(Function) < 0 )
{
List->Add( Function );
}
}
Now I'm also thinking that the typedef does not resolve to 4
bytes anyway. Can I do this?
~ JD
|
|
| Back to top |
|
 |
Liz Albin Guest
|
Posted: Tue Mar 22, 2005 6:31 am Post subject: Re: Pointers to functions |
|
|
On 21 Mar 2005 21:32:29 -0800, JD wrote:
| Quote: | I want to build a list of pointers to functions but I can't
resolve the compiler errors:
|
Are the functions in question method pointers? it makes a difference
--
Good luck,
liz
|
|
| Back to top |
|
 |
Thomas Maeder [TeamB] Guest
|
Posted: Tue Mar 22, 2005 6:31 am Post subject: Re: Pointers to functions |
|
|
"JD" <nospam (AT) nospam (DOT) com> writes:
First of all:
You are writing about pointers to functions in the subject and part of
your post. But your code is using closures. Please note that the two
are quite different beasts, even if they usually serve similar
purposes.
Which one is it that you want?
| Quote: | I want to build a list of pointers to functions but I can't
resolve the compiler errors:
AddFunction( &FunctionName );
The above produces two errors:
Cannot convert 'void (_fastcall * (_closure )(AParam &))(AParam &)'
to 'void (_fastcall * (_closure *)(AParam &) *)(AParm &)'
Type mismatch in parameter 1
wanted 'void (_fastcall * (_closure *)(AParam &) *)(AParam &)',
got 'void (_fastcall * (_closure )(AParam &))(AParam &)'
typedef void __fastcall (__closure *Function)( AParam& );
void AddFunction( TFunction Function )
{
if( List->IndexOf(Function) < 0 )
{
List->Add( Function );
}
}
|
Please post the minimal program that lets us see what you are
seeing. That would (in this case) be more code than you have posted
here; just enough that we can cause our compilers to spit out the
error messages you are seeing.
| Quote: | Now I'm also thinking that the typedef does not resolve to 4
bytes anyway.
|
I don't know what you mean, but numbers of bytes are very unlikely to
be the issue here.
Can you do what?
|
|
| Back to top |
|
 |
JD Guest
|
Posted: Tue Mar 22, 2005 7:32 am Post subject: Re: Pointers to functions |
|
|
[email]maeder (AT) glue (DOT) ch[/email] (Thomas Maeder [TeamB]) wrote:
| Quote: |
[...] Please post the minimal program that lets us see what
you are seeing. [...]
|
LOL. Thanks for that. I found the problem:
void __fastcall RegisterFunction( TUpdateFunction* );
has been changed to:
void __fastcall RegisterFunction( TUpdateFunction );
and now the error messages make perfect sense to me <g>.
~ JD
|
|
| Back to top |
|
 |
JD Guest
|
Posted: Tue Mar 22, 2005 7:34 am Post subject: Re: Pointers to functions |
|
|
Liz Albin <lizalbin (AT) yahooNotThis (DOT) com> wrote:
| Quote: |
Are the functions in question method pointers? it makes a
difference
|
It was a type-o. How unusual!!! <g>
~ JD
|
|
| Back to top |
|
 |
|