G
Guest
I'm writing a Windows Forms application in C++.NET.
I've defined function F which takes 2 arguments a & b.
I need to use the pointer of F inside another function G & I can't
figure out how to do it properly.
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
//....(inside a Windows Form)...
G(...,pf(a,b),...); //using the function pointer inside of G
The compiler tells me at the pf = F line :
error C2501: 'pf' : missing storage-class or type specifiers
error C2373: 'PixelinkE:f' : redefinition; different type modifiers
error C2440: 'initializing' : cannot convert from 'U32 (__stdcall
*)(HANDLE,LPVOID)' to 'int'
It seems that it doesn't like the way that pf is defined..
Is this the correct way to declare & use a function pointer or are there
better ways ?
Thanks,
ak
I've defined function F which takes 2 arguments a & b.
I need to use the pointer of F inside another function G & I can't
figure out how to do it properly.
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
//....(inside a Windows Form)...
G(...,pf(a,b),...); //using the function pointer inside of G
The compiler tells me at the pf = F line :
error C2501: 'pf' : missing storage-class or type specifiers
error C2373: 'PixelinkE:f' : redefinition; different type modifiers
error C2440: 'initializing' : cannot convert from 'U32 (__stdcall
*)(HANDLE,LPVOID)' to 'int'
It seems that it doesn't like the way that pf is defined..
Is this the correct way to declare & use a function pointer or are there
better ways ?
Thanks,
ak