On Sep 13, 2007, at 9:31 PM, Norman Palardy wrote:
> Basically
> dim pc as PluginClass
> dim pi as RBClassThatImplementsTheInterface
>
> pi = new RBClassThatImplementsTheInterface
>
> pc = new PluginClass(pi)
>
> in my plugin I have code that hangs on to the instance and locks it
> like
>
> void ConstructorWithParams ( REALobject instance, REALobject
> iFuncsProvider )
>
> {
>
> ClassData (Class, instance, data, local);
>
> REALLockObject(iFuncsProvider) ;
>
> local->iFuncsProvider = iFuncsProvider ;
>
> }
Not sure what you do here. I guess you would want to use
"RBClassThatImplementsTheInterface" as a registration of a
PluginClass that implements the interface.
When you call
Boolean SomeFunc(data *instance)
{
Boolean (*func)(void);
func = ( Boolean(*)(void) )
REALInterfaceRoutine (instance->iFuncsProvider,
"iFunctions", "SomeFunc() as Boolean");
if (! func)
return false;
return func();
}
the instance variable to call the interface on, should be on the
PluginClass instance and not on the "iFuncsProvider", because the
user, the caller, of PluginClass had indicated that PluginClass
promised to implement the methods defined in the interface (I suppose
that as a given).
Isn't that how interfaces work? Another approach is to simply define
a REALevent on the PluginClass, and within your plugin you would
invoke that event, but bottom line, in both cases you would call the
so called "Callback" on the PluginClass instance...
Granted, if RBClassThatImplementsTheInterface is registered as a
class, and the interface field of this class definition contains
"iFunctions" (or should contain it when added in the RB_IDE) then you
were not clear at all. A further excerpt is in that case beyond the
scope of this thread.
Alfred
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>