Re: SAFEARRAY(Interface)
- From: "Michael Hoffmann" <m.hoffmann AT compar.cc>
- Date: Thu, 5 Jul 2007 10:30:02 +0200
Hello Brian,
thanks for jumping in.
This method definition is clearly not automation-compliant. So it means that a custom proxy-stub must be generated by the MIDL
compiler.
Out of the box, if you try to define the above COM interface method, the MIDL compiler give a warning message:
MIDL2456: SAFEARRAY(interface pointer) doesn't work using midl generated proxy.
I haven't explored this to any degree, but I'm sure this is an important warning: the proxy that is automatically generated won't
handle this correctly. This is really an indication that the MIDL compiler has reached its limits in implementation.
If you have any control over the definition of this method, obviously I highly recommend that you change this to something that
can be meaningfully marshaled. This could be a conformant array of interfaces (if using a proxy-stub) or a SAFEARRAY of IUnknown
pointers (if you want to be automation-compliant).
However, I'm guessing that this is a COM object that was developed by someone else and that you have no control over the method's
signature. If so, I'm speculating that this COM object's interface was designed not to be marshaled at all, and therefore the COM
object must live in the same apartment as its client. You may be having trouble simply because you are violating this assumption
on the author's part.
The interface we are accessing is a dual interface. Calling the method using
IDispatch doesn't work in our environment due to limitations that are beyond
our control. Calling the method from Visual Basic works perfectly. I assume
that VB reads the type library and properly wraps the parameter. What I
don't know is, if VB calls the method directly or if it uses IDispatch. The
server resides in another process, so marshalling does take place.
It's difficult to comment much more, because you have provided so little information. It would be helpful if you told us what
language you are using on the client side, what apartment the client is running in, and what threading model is defined by the COM
object.
I'll be back with more details.
Best regards,
Michael
.
- References:
- SAFEARRAY(Interface)
- From: Michael Hoffmann
- Re: SAFEARRAY(Interface)
- From: Brian Muth
- SAFEARRAY(Interface)
- Prev by Date: Re: SAFEARRAY(Interface)
- Next by Date: Re: version in codebase
- Previous by thread: Re: SAFEARRAY(Interface)
- Next by thread: How to get the container interface pointer?
- Index(es):
Relevant Pages
|
Loading