How is using COM objects through "raw" pointers called?
We have a rather old COM-like component wuth a set of rather complex interfaces. Those interfaces are quite problematic to marshal, so we don't register anything in registry but instead export a CreateMainObject()
function from the component DLL that retrieves a IMainObject
pointer and IMainObject
interface has a huge set of other functions.
This way the client never calls CoCreateInstance()
- instead it calls Loa开发者_StackOverflowdLibraryEx()
/GetProcAddress()
and then invokes CreateMainObject()
function. No marshalling can ever be done since COM doesn't actually enter the scene - all actions are performed by directly calling methods on those objects. Everything is very fast but of course not thread-safe and wn't work in a COM+ surrogate.
Is there a term for such usage of COM interfaces?
The term you seek is "incorrect", as in "This is an incorrect usage of COM interfaces".
Why not register ICreateMainObject
derived from IUnknown
(or IDispatch
if you prefer) with one method, ICreateMainObject::CreateMainObject
, then use this method to instantiate your object using valid COM semantics.
精彩评论