Re: using a function pointer in another function
- From: "Vladimir Nesterovsky" <vladimir@xxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 27 Jul 2005 22:22:04 +0200
> Here's what I have :
>
> U32 (*pf) (HANDLE, LPVOID); //declaring the function pointer
>
> U32 __stdcall F (HANDLE a, LPVOID b) //defining F
> {
> ......
>
> return 0;
> }
> pf = F; //assigning the address of F to pf
I believe last expression is in the some function's body, otherwise it's
invalid.
If you want to declare and initialize static variable you have to write
U32 (__stdcall *pf) (HANDLE, LPVOID) = F;
or
typedef U32 (__stdcall * func_pointer) (HANDLE, LPVOID);
func_pointer pf = F;
--
Vladimir Nesterovsky
e-mail: vladimir@xxxxxxxxxxxxxxxxxxxx
home: http://www.nesterovsky-bros.com
.
- Follow-Ups:
- References:
- Prev by Date: Re: __declspec(dllexport) to return char but errors in VB6
- Next by Date: Re: strange pointer behavior
- Previous by thread: Re: using a function pointer in another function
- Next by thread: Re: using a function pointer in another function
- Index(es):
Relevant Pages
|