G
Guest
I'm writing a program to Host the CLR. As part of this I would like to run my managed code in an AppDomain other than the DefaultDomain. My understanding is that I can do after loading and starting the CLR by using CorBindToRuntimeEx to obtain a pointer to ICorRuntimeHost. With this interface pointer I would next call the method CreateDomainSetup. From this method I get back a pointer to an IAppDomainSetup interface. Now, with this interface pointer can set the Application Base to a directory of my choice. Well when I try to set this property I get the following error
Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention
The code I'm using is as follows
HRESULT hr
hr = CoInitialize(NULL)
LPWSTR pszVer = NULL
LPWSTR pszFlavor = L"wks"
ICorRuntimeHost *pHost = NULL
hr = CorBindToRuntimeEx(pszVer,
pszFlavor,
STARTUP_LOADER_OPTIMIZATION_SINGLE_DOMAIN | STARTUP_CONCURRENT_GC,
CLSID_CorRuntimeHost,
IID_ICorRuntimeHost,
(void **)&pHost)
pHost->Start()
// Get the IAppdomainSetu
IAppDomainSetup *pAppDomainSetupPunk = NULL
hr = pHost->CreateDomainSetup((IUnknown **)&pAppDomainSetupPunk)
// Set the AppBAse pro
wchar_t wszAppBase[] = L"c:\\AppDomainBase\0"
BSTR bstrAppBase = SysAllocString(wszAppBase)
hr = pAppDomainSetupPunk->put_ApplicationBase(bstrAppBase)
Program halts on the line above
Has anyone done this? What am I missing?
Thanks
Bob.
Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention
The code I'm using is as follows
HRESULT hr
hr = CoInitialize(NULL)
LPWSTR pszVer = NULL
LPWSTR pszFlavor = L"wks"
ICorRuntimeHost *pHost = NULL
hr = CorBindToRuntimeEx(pszVer,
pszFlavor,
STARTUP_LOADER_OPTIMIZATION_SINGLE_DOMAIN | STARTUP_CONCURRENT_GC,
CLSID_CorRuntimeHost,
IID_ICorRuntimeHost,
(void **)&pHost)
pHost->Start()
// Get the IAppdomainSetu
IAppDomainSetup *pAppDomainSetupPunk = NULL
hr = pHost->CreateDomainSetup((IUnknown **)&pAppDomainSetupPunk)
// Set the AppBAse pro
wchar_t wszAppBase[] = L"c:\\AppDomainBase\0"
BSTR bstrAppBase = SysAllocString(wszAppBase)
hr = pAppDomainSetupPunk->put_ApplicationBase(bstrAppBase)
Program halts on the line above
Has anyone done this? What am I missing?
Thanks
Bob.