[vtkusers] Help: SetExecuteMethod(void(* f)(void *), void * arg) in MFC application

Ian Miller MrMiller at shelob.plus.com
Fri Sep 26 18:33:43 EDT 2003


Hello Ignazio,

> in a "win32console application" I define a function:
>  void ReadPoints (void *arg)
> and then I use:
>  pointSource->SetExecuteMethod(ReadPoints, (void *)pointSource );
> This is right!!

Not so fast! :-)

> But... the compiler doesn't accept the first parameter.
> I have the following message:
>  cannot convert parameter 1 from 'void (void *)' to 'void (__cdecl *)(void
*)'

Which looks to me like the function must have C linkage (as opposed to the
normal C++ kind).  That's what the __cdecl is telling you.  Try your first
ReadPoints function again but declare it like so:

extern "C" void ReadPoints(void* arg);

I think that will help. Please don't shoot me if it doesn't.

Ian




More information about the vtkusers mailing list