realbasic-plugins
[Top] [All Lists]

calling methods of a class in RB

To: REALbasic Plugins <REALbasic-Plugins at lists dot realsoftware dot com>
Subject: calling methods of a class in RB
From: Norman Palardy <npalardy at great-white-software dot com>
Date: Thu, 13 Sep 2007 19:31:59 -0600
Delivered-to: listarchive at realsoftware dot com
Delivered-to: REALbasic-Plugins at lists dot realsoftware dot com
Using the OLD plugin SDK at the moment

I've defined a class and an interface in a plugin

In my RB code I have a class that implements the interface

When I make a new instance of the plugins class, I need to construct  
it with an instance that implements the interface

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 ;
        
        }

When trying to call one of the methods in the RB instance I'm doing

        Boolean  SomeFunc(data *instance)
        {
                Boolean (*func)(void);
                func = ( Boolean(*)(void) ) REALLoadObjectMethod(instance- 
 >iFuncsProvider, "SomeFunc() as Boolean");
                if (not func)
                        return false;
        
                return func();
        }

But I always get a failed assertion, failure condition classDef with  
no message

I think I have everything set up right.
If I change SomeFunc to

        Boolean  SomeFunc(data *instance)
        {
                if (instance->iFuncsProvider == NULL)
                        return false;
                else
                        return true ;   
        }

this returns true so I seem to have the object reference saved OK.  
It's at least non-null

Thoughts ?
I'd be happy to send my project to someone off list to go over it in  
more detail


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>


From  Fri 14 Sep 2007 03:57:54 +0200
Return-Path: <realbasic-plugins-bounces at lists dot realsoftware dot com>
X-Original-To: listarchive at realsoftware dot com
Delivered-To: listarchive at realsoftware dot com
Received: by xmail.realsoftware.com (Postfix, from userid 1037)
        id 4305B42B5D5D; Thu, 13 Sep 2007 18:59:07 -0700 (PDT)
X-Spam-Checker-Version: SpamAssassin 3.1.1 (2006-03-10) on 
        www.realsoftware.com
X-Spam-Level: 
X-Spam-Status: No, score=-2.5 required=4.5 tests=AWL,BAYES_00 autolearn=ham 
        version=3.1.1
Received: from lists.realsoftware.com (m.realsoftware.com [66.116.103.65])
        by xmail.realsoftware.com (Postfix) with ESMTP id 05A0742B5D52;
        Thu, 13 Sep 2007 18:59:03 -0700 (PDT)
Received: from real-software-mini.local (localhost [127.0.0.1])
        by lists.realsoftware.com (Postfix) with ESMTP id 0FEAB66400C;
        Thu, 13 Sep 2007 20:58:48 -0500 (CDT)
X-Original-To: realbasic-plugins at lists dot realsoftware dot com
Delivered-To: realbasic-plugins at lists dot realsoftware dot com
Received: from smtprelay11.ispgateway.de (smtprelay11.ispgateway.de
        [80.67.29.28])
        by lists.realsoftware.com (Postfix) with ESMTP id B22B4664001
        for <realbasic-plugins at lists dot realsoftware dot com>;
        Thu, 13 Sep 2007 20:58:43 -0500 (CDT)
Received: (qmail 31985 invoked from network); 14 Sep 2007 01:58:55 -0000
Received: from unknown (HELO [192.168.1.80]) (363246 at [84 dot 175 dot 74 dot 
224])
        (envelope-sender <support at monkeybreadsoftware dot de>)
        by smtprelay11.ispgateway.de (qmail-ldap-1.03) with SMTP
        for <realbasic-plugins at lists dot realsoftware dot com>;
        14 Sep 2007 01:58:55 -0000
To: realbasic-plugins at lists dot realsoftware dot com (REALbasic Plugins)
In-Reply-To: <45D0BBF8-6AFF-42F4-B9F9-FFAD82BCE653 at great-white-software dot 
com>
Subject: Re: calling methods of a class in RB
From: support at monkeybreadsoftware dot de (Christian Schmitz)
Date: Fri, 14 Sep 2007 03:57:54 +0200
Message-ID: <1i4ew8g dot 1h1kv9p1qlu0qgM%support at monkeybreadsoftware dot de>
MIME-Version: 1.0
Organization: Monkeybread Software Germany
X-Face: nrf3>{WQ6c&r+7 at e)"]0G60`-6ND^)I2mI%>)QGYa=9"=7jhd-g2|b3!>Al0+
        Ccb%xGQshhi|g at QU2$
User-Agent: MacSOUP/D-2.8 (Mac OS X version 10.4.9 (PPC))
X-BeenThere: realbasic-plugins at lists dot realsoftware dot com
X-Mailman-Version: 2.1.9
Precedence: list
Reply-To: REALbasic Plugins <realbasic-plugins at lists dot realsoftware dot 
com>
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Sender: realbasic-plugins-bounces at lists dot realsoftware dot com
Errors-To: realbasic-plugins-bounces at lists dot realsoftware dot com

Norman Palardy <npalardy at great-white-software dot com> wrote:

>               func =3D ( Boolean(*)(void) ) REALLoadObjectMethod(instance-

Don't load using REALLoadObjectMethod. It was defined much later than
interfaces.

Use REALInterfaceRoutine:

REALInterfaceRoutine
68k PPC OSX Win X11 =

RB 2.1

This function is for supporting binds. It returns the method on the
given object which implements the given method name, of the class
interface defined by interfaceName.

Parameters:
obj
REALobject
object which implements a binding method
interfaceName
const char *
binding interface to look for
methodName
const char *
specific method to look for
Returns:
REALproc
method implementation, or nil if not found


Gru=DF
Christian

-- =

Over 800 classes with 16000 functions in one REALbasic plug-in. =

The Monkeybread Software Realbasic Plugin v7.5. =


<http://www.monkeybreadsoftware.de/realbasic/plugins.shtml>
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>