Click to See Complete Forum and Search --> : Marshaling Dispatch Pointers


Phil Jollans
April 11th, 1999, 06:48 PM
I am having a very frustrating time trying to pass interface pointers as parameters.

I am writing components with ATL and testing them in a Visual Basic application.

I have two problems:

1. I am calling a method in a method on an In-Process object in multi threaded Apartment via Proxy/Stub. The method should return an IDispatch pointer, but the marshalling generates an error.

To try to find it, I have disabled Type-Library marshaling and merged the ATL generated Proxy/Stub into my DLL. I have also removed the /Oicf so that I can debug into the marshalling code. I see that an exception is thrown by the function NdrPointerBufferSize(), but I don't know why.

With type library marshaling, the same basic effect occurs, so it doesn't seem to be a fault in the Proxy/Stub code

2. The other problem has nothing to do with marshalling. I have defined a method which takes an interface pointer as a parameter and a property which is an interface pointer. I have implemented whtm with identical functionality. When I use them from Visual Basic, only the Property works. The Method fails, without even being entered. The error message is something like, this method is not supported. I cannot for the life in me understand why the property should work, but the method should fail. (I would prefer to use a method, because it makes more sense in the application).

The problem only occurs from VB. I can call the method without any problem from VC++.

Phil Jollans

Danmir
April 22nd, 1999, 06:35 AM
I work in a team at a project using DCOM. We encountered some problems with marshaling a Dispatch Interface. The problems have been resolved when we put in idl file the specification [out, retval] for the Dispatch parameter. Of course the parameter must be IDispatch**.
Maybe this can resolve your communication via Proxy/Stub.