Board index » delphi » Passing interfaces as parameters in interface methods

Passing interfaces as parameters in interface methods

To the best of my knowledge you can pass interfaces without a problem as
long as they are defined as such in the type libraries.

Ron.

Quote
Artur Szostak wrote in message <716td8$d...@forums.borland.com>...
>I would like to know if passing a local interface pointer (from a client)
as
>a parameter to a interface method (on the server) should work?

>If this will not work I would like to know why?

>If it should work then I would like to know if the interface pointer can
>passed on further in the same fashion.

>Artur

 

Re:Passing interfaces as parameters in interface methods


Artur,

Is your goal to pass just the interface or the implementation of the interface?
If you are passing an object which implements an interface, it will not work.
The problem lies with passing pointers across process space boundaries.  I tried
to do this same thing to implement a callback feature where my server called a
function on my client to signal an event. It failed with all sorts of amusing
error messages.  Try reading the article by Binh Ly:

http://www.castle.net/~bly/Programming/Delphi

It looks promising.

there is another message from alan Greggains with the title 'callback problem'
which
talks about using the following method:

Clients pass an OleVariant  (OleVar :=
ObjectFactory.CreateComObject(nil) as IDispatch) to the server.

Callback is achieved by calling OleVar.CallbackMethod

-Scott

Quote
Artur Szostak wrote:
> I would like to know if passing a local interface pointer (from a client) as
> a parameter to a interface method (on the server) should work?

> If this will not work I would like to know why?

> If it should work then I would like to know if the interface pointer can
> passed on further in the same fashion.

> Artur

>                       Name: ATT00051.gif
>    ATT00051.gif       Type: GIF Image (image/gif)
>                   Encoding: x-uuencode

Other Threads