I have a c++ code that callls csharp. Now I want to be able to pass
a function pointer from C++ to Csharp code and have c# callback to it.
Is it possible and how?
Here is what I have so far :
#include "windows.h"
#include <stdio.h>
#import "CSDll.tlb" named_guids
int main(int argc, char* argv[])
{
HRESULT hRes = S_OK;
CoInitialize(NU LL);
CSDll::IMyManag edInterface *pManagedInterf ace = NULL;
hRes = CoCreateInstanc e(CSDll::CLSID_ Class1, NULL,
CLSCTX_INPROC_S ERVER,
CSDll::IID_IMyM anagedInterface , reinterpret_cas t<void**>
(&pManagedInter face));
if (S_OK == hRes)
{
hRes = pManagedInterfa ce->raw_Run();
pManagedInterfa ce->Release();
}
CoUninitialize( );
return 0;
}
a function pointer from C++ to Csharp code and have c# callback to it.
Is it possible and how?
Here is what I have so far :
#include "windows.h"
#include <stdio.h>
#import "CSDll.tlb" named_guids
int main(int argc, char* argv[])
{
HRESULT hRes = S_OK;
CoInitialize(NU LL);
CSDll::IMyManag edInterface *pManagedInterf ace = NULL;
hRes = CoCreateInstanc e(CSDll::CLSID_ Class1, NULL,
CLSCTX_INPROC_S ERVER,
CSDll::IID_IMyM anagedInterface , reinterpret_cas t<void**>
(&pManagedInter face));
if (S_OK == hRes)
{
hRes = pManagedInterfa ce->raw_Run();
pManagedInterfa ce->Release();
}
CoUninitialize( );
return 0;
}
Comment