Thank you very much for your help.
brosembob@yahoo.com wrote:
Igor,
I apologize for the example. I'm new to C++. Does this make sense?
//*******************************************************************
int main()
{
CLRHost* clrHost = CreateCLRHost();
}
CLRHost* CreateCLRHost(void)
{
CLRHost* clrHost = new CLRHost();
...
return clrHost;
}
That's better. Assuming clrHost in main() is eventually deleted, I don't
see any problems.
I guess what I'm trying to do is to figure out whether by using this
approach I would create many instances of CLRHost class, each of which
would have its own instance of spRuntimeHost object.
Yes you would. I assume (but don't really know) that CorBindToRuntimeEx
does create a new instance of CorRuntimeHost object with every call, as
opposed to, say, creating it once, caching the pointer and returning the
same pointer with every subsequent call.
Also by creating
clrHost object and a copy spRuntimeHost in it would not create any
kind of memory leak.
I don't see any memory leaks - again, assuming you at some point delete
every CLRHost object you've created.
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925