T
Tyler
Can someone help by explaining why the following class will not compile
(VS2005), and what can be done to pass the function pointer to the "C"
method?
When I compile the following program, I get "error C2664: 'CMethod' : cannot
convert parameter 1 from 'Test:oItFn ^' to 'void (__cdecl *)(void *)':
#include "stdafx.h"
void CMethod(void (* pfvFunPointer)(void *), void * pfvValue)
{
(*pfvFunPointer)(pfvValue);
return;
}
ref class Test
{
public:
delegate void DoItFn(void * pfvValue);
virtual void DoIt(void * pfvValue)
{
return;
}
virtual void Run()
{
DoItFn ^ tvfnDoIt = gcnew DoItFn(this, &Test:oIt);
CMethod(tvfnDoIt, nullptr);
return;
}
};
Can someone please help? Any good documentation references would also be
appreciated.
Thanks, Tyler
(VS2005), and what can be done to pass the function pointer to the "C"
method?
When I compile the following program, I get "error C2664: 'CMethod' : cannot
convert parameter 1 from 'Test:oItFn ^' to 'void (__cdecl *)(void *)':
#include "stdafx.h"
void CMethod(void (* pfvFunPointer)(void *), void * pfvValue)
{
(*pfvFunPointer)(pfvValue);
return;
}
ref class Test
{
public:
delegate void DoItFn(void * pfvValue);
virtual void DoIt(void * pfvValue)
{
return;
}
virtual void Run()
{
DoItFn ^ tvfnDoIt = gcnew DoItFn(this, &Test:oIt);
CMethod(tvfnDoIt, nullptr);
return;
}
};
Can someone please help? Any good documentation references would also be
appreciated.
Thanks, Tyler