Thanks for the information Willy. I've gone through that and also I got
some more information from Google.
Now I've done
// 1. Call CorBindToRuntimeEx
CComPtr<ICorRuntimeHost> spRuntimeHost;
HRESULT hr = 0 ;
hr = CorBindToRuntimeEx(_T("v2.0.50727"), _T("wks"),
STARTUP_LOADER_OPTIMIZATION_SINGLE_DOMAIN | STARTUP_CONCURRENT_GC,
CLSID_CorRuntimeHost, IID_ICorRuntimeHost,
(LPVOID*)(&spRuntimeHost));
//2. Starting the CLR
hr = spRuntimeHost->Start();
//3. Getting _AppDomain interface
CComPtr<IUnknown> spUnk;
hr = spRuntimeHost->GetDefaultDomain(&spUnk);
_AppDomainPtr spDefAppDomain;
hr = spUnk->QueryInterface(&spDefAppDomain);
//4. Getting IDispatch of the managed object (calling GetIDsOfNames on
the
//managed object directly seems to fail. Mangled method names?)
CComPtr<_ObjectHandle> spObjectHandle;
hr = spDefAppDomain->CreateInstance( CComBSTR("GetBLOB"),
CComBSTR("ManagedBLOB::UserSettings"), &spObjectHandle);
But CreateInstance fails ...And the hr shows as "The system cannot find
the file specified."
And the spObjectHandle is null.
I'd be glad to know , If I am doing some thing wrong.
Regards,
RSL.
[quoted text, click to view] Willy Denoyette [MVP] wrote:
> <sreelakshmi.rajula@gmail.com> wrote in message
> news:1165486104.978190.290380@l12g2000cwl.googlegroups.com...
> > I've a managed c++ dll. How can I use this in unmanaged C++
> > application.I am using Visual studio 2005.
> > I read something about regasm....May I know how can I use that?
> > Thanks in advance.
> > Regards,
> > RSL.
> >
>
> Please read the documentation, more specifically read C++ interop in MSDN
>
http://msdn2.microsoft.com/en-us/library/ms177552(vs.80).aspx
>
>
> Willy.