cannot convert argument 1 from 'int (__cdecl *)(vtkMultiProcessController *,void *)' to 'vtkProcessFunctionType'


Hi All,

I get the following error while building my VTK project

error C2664: 'void vtkMultiProcessController::SetSingleMethod(vtkProcessFunctionType,void *)': cannot convert argument 1 from 'int (__cdecl *)(vtkMultiProcessController *,void *)' to 'vtkProcessFunctionType'

The following lines of code are relevant
vtkMultiProcessController *controller = vtkMPIController::New();
controller->Initialize(&argc, &argv);

controller->SetSingleMethod(my_function_call, 0);

my_function_call is defined as

int my_function_call(vtkMultiProcessController *controller, void* vtkNotUsed(arg));

How do I make use of the vtkProcessFunctionType class ? I can’t find any examples.

Please someone should provide me with an example. I will be very grateful.

Kind Regards

(Ben Boeckel) #2

The declaration is:

typedef void (*vtkProcessFunctionType)(vtkMultiProcessController *controller,
                                       void *userData);

So the return type needs to be void, not int.


Thank you Ben. It has worked now.