More questions about casting function pointers ..



Hi,

I have two func ptr prototypes declared as :

typedef void (*VFP)(void) ;
typedef int(MyCallback*)(enum_1, enum2, int, void*) ;

I hav a struct as ff:

typedef struct  {
  VFP mini_callback ;
  VFP data_callback ;
  ...
}FunctorStruct ;

I can assign a function ptr of type MyCallback to mini_callback or data_callback (after suitable casts to VFP).

Assuming i have function foo defined as ff:

int foo( FunctorStruct *fctor ) {
	/* code here to call function pointed to by data_callback
	assuming we know the function pointed to is of type
	MyCallback */

(MyCallback)fctor->data_callback( ONE, TWO, 100, NULL ) ; /* <- dosen't compile !*/
}



The compiler dosen't grok this. When I try to compile the above snippet, it (the compiler) barfs and issues the ff message: "'VFP' : too many arguments for call through pointer-to-function".


How do I call the function - cast to its correct type?

tkx

.



Relevant Pages

  • Re: endless loop dll hell?
    ... inside of a small vfp project, say for example, compile to at least an APP ... I do not see anything in your codebase that would be considered dll hell, ... I'm gonna assume you are talking about the run time modules for VFP. ...
    (microsoft.public.fox.vfp.forms)
  • Re: Project manager, compile before saving?
    ... Perhaps what you are experiencing is that VFP loves to cache things. ... > modification work, that right?. ... untill I compile it (not only main.prg but all from Project ...
    (microsoft.public.fox.programmer.exchange)
  • Re: VFP COM DLL running in IIS6.0 cause IIS to crash
    ... The VFP7 runtimes will not overwrite the VFP6 ones, ... > the whole VPF7.0 package into the production server for debug purpose, ... > compile it into a COM object and called in ASP. ... >> If you plan on upgrading VFP, I would go to VFP 9.0 not any earlier ...
    (microsoft.public.fox.helpwanted)
  • Re: FoxPro public variable problem in multithreaded VB.NET app
    ... I assumed it was "shared friend" because when I compiled the VFP DLL ... when you compile the dll as a single threaded ... classes insantiated that refer to several PUBLIC variables and it ...
    (microsoft.public.dotnet.framework.interop)
  • RE: VFP6 exception
    ... What version of VFP 6.0 did you use to compile the executable? ... you used SP4 to compile the EXE, you need the SP4 runtime files. ... This posting is provided "AS IS" with no warranties, and confers no rights. ...
    (microsoft.public.fox.programmer.exchange)