Board index » cppbuilder » RPC_S_INTERNAL_ERROR (0x800706e6) when call COM method with SAFEARRAY arg

RPC_S_INTERNAL_ERROR (0x800706e6) when call COM method with SAFEARRAY arg

I just implemented a new method in a custom interface in my inproc (DLL) COM
server.  The IDL definition:

  HRESULT TestArray(
        [in] SAFEARRAY(long) *ppsaIn,
        [out] SAFEARRAY(long) *ppsaOut);

I get the identical error when I invoke this method from either Borland C++
Builder 3 or Visual Basic 5:  0x800706e6, which is RPC_S_INTERNAL_ERROR.  A
breakpoint in the method implementation is never reached.  So something seems to
be going wrong within the guts of COM.  I can invoke other methods within this
interface without any problems;  however, TestArray is the only method using
SAFEARRAY arguments.

Everything is running under Win95.

Do you have any idea why I'm getting this error & how to fix it?

=======================================================
Dave Morgenlender
e-mail: dmor...@alum.mit.edu
=======================================================

 

Re:RPC_S_INTERNAL_ERROR (0x800706e6) when call COM method with SAFEARRAY arg


I dont think, SAFEARRAY can be used in custom interfaces. I Think it
needs the typelibrary marshalling to help it out.  Why are you using
SAFEARRAY anyway? You can use size_is, length_is and other wonderful
attributes in IDL to pass arrays.
Anyway, SAFEARRAY might work if you put that [oleautomation] attribute
on that interface.

Quote
David Morgenlender wrote:

> I just implemented a new method in a custom interface in my inproc (DLL) COM
> server.  The IDL definition:

>   HRESULT TestArray(
>         [in] SAFEARRAY(long) *ppsaIn,
>         [out] SAFEARRAY(long) *ppsaOut);

> I get the identical error when I invoke this method from either Borland C++
> Builder 3 or Visual Basic 5:  0x800706e6, which is RPC_S_INTERNAL_ERROR.  A
> breakpoint in the method implementation is never reached.  So something seems to
> be going wrong within the guts of COM.  I can invoke other methods within this
> interface without any problems;  however, TestArray is the only method using
> SAFEARRAY arguments.

> Everything is running under Win95.

> Do you have any idea why I'm getting this error & how to fix it?

> =======================================================
> Dave Morgenlender
> e-mail: dmor...@alum.mit.edu
> =======================================================

--
Girish Bharadwaj [vc++/mvp]

Re:RPC_S_INTERNAL_ERROR (0x800706e6) when call COM method with SAFEARRAY arg


Girish,

Quote
>I dont think, SAFEARRAY can be used in custom interfaces. I Think it
>needs the typelibrary marshalling to help it out.  Why are you using
>SAFEARRAY anyway? You can use size_is, length_is and other wonderful
>attributes in IDL to pass arrays.
>Anyway, SAFEARRAY might work if you put that [oleautomation] attribute
>on that interface.

This server must be usable from both C++ & VB5 (or later).  Does VB support
those other methods of passing arrays?  I was under the impression that VB only
supported SAFEARRAYs ... but it wouldn't be the first time I'm wrong <g>!

=======================================================
Dave Morgenlender
e-mail: dmor...@alum.mit.edu
=======================================================

Re:RPC_S_INTERNAL_ERROR (0x800706e6) when call COM method with SAFEARRAY arg


David,

If you like the interface to be usable from VB5, its better to use
a dual interface instead of a custom interface. This will imply the
oleautomation attribute and should solve your problem.
Only if you really need custom variable types you should consider
the custom interface.

Regards,
Stefan Cuypers

Quote
David Morgenlender wrote in message <3622f052.98842...@enews.newsguy.com>...
>Girish,

>>I dont think, SAFEARRAY can be used in custom interfaces. I Think it
>>needs the typelibrary marshalling to help it out.  Why are you using
>>SAFEARRAY anyway? You can use size_is, length_is and other wonderful
>>attributes in IDL to pass arrays.
>>Anyway, SAFEARRAY might work if you put that [oleautomation] attribute
>>on that interface.

>This server must be usable from both C++ & VB5 (or later).  Does VB support
>those other methods of passing arrays?  I was under the impression that VB
only
>supported SAFEARRAYs ... but it wouldn't be the first time I'm wrong <g>!

>=======================================================
>Dave Morgenlender
>e-mail: dmor...@alum.mit.edu
>=======================================================

Re:RPC_S_INTERNAL_ERROR (0x800706e6) when call COM method with SAFEARRAY arg


Stefan,

Quote
>If you like the interface to be usable from VB5, its better to use
>a dual interface instead of a custom interface. This will imply the
>oleautomation attribute and should solve your problem.
>Only if you really need custom variable types you should consider
>the custom interface.

I originally had dual interfaces.  Then I discovered that dual interfaces don't
support structs, which I need!

=======================================================
Dave Morgenlender
e-mail: dmor...@alum.mit.edu
=======================================================

Re:RPC_S_INTERNAL_ERROR (0x800706e6) when call COM method with SAFEARRAY arg


Let me break in. Why the 'in' parameter has double indirection?

Alexander

Quote
David Morgenlender wrote in message <3618b955.83241...@enews.newsguy.com>...
>Stefan,

>>If you like the interface to be usable from VB5, its better to use
>>a dual interface instead of a custom interface. This will imply the
>>oleautomation attribute and should solve your problem.
>>Only if you really need custom variable types you should consider
>>the custom interface.

>I originally had dual interfaces.  Then I discovered that dual interfaces
don't
>support structs, which I need!

>=======================================================
>Dave Morgenlender
>e-mail: dmor...@alum.mit.edu
>=======================================================

Re:RPC_S_INTERNAL_ERROR (0x800706e6) when call COM method with SAFEARRAY arg


Alexander,

Quote
>Let me break in. Why the 'in' parameter has double indirection?

Everything I've read said that's how SAFEARRAYs work.  You put a single
indirection in the IDL file, which produces function prototypes with double
indirection.  Beyond that, I don't know.

=======================================================
Dave Morgenlender
e-mail: dmor...@alum.mit.edu
=======================================================

Other Threads