S
sasha
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(NULL);
CSDll::IMyManagedInterface *pManagedInterface = NULL;
hRes = CoCreateInstance(CSDll::CLSID_Class1, NULL,
CLSCTX_INPROC_SERVER,
CSDll::IID_IMyManagedInterface, reinterpret_cast<void**>
(&pManagedInterface));
if (S_OK == hRes)
{
hRes = pManagedInterface->raw_Run();
pManagedInterface->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(NULL);
CSDll::IMyManagedInterface *pManagedInterface = NULL;
hRes = CoCreateInstance(CSDll::CLSID_Class1, NULL,
CLSCTX_INPROC_SERVER,
CSDll::IID_IMyManagedInterface, reinterpret_cast<void**>
(&pManagedInterface));
if (S_OK == hRes)
{
hRes = pManagedInterface->raw_Run();
pManagedInterface->Release();
}
CoUninitialize();
return 0;
}