Hi Joe,
That makes sense. Here's what I need, then:
I am using an OS API to register a callback in C++ (specifically, for when
HID device events occur), and I need to pass in a function pointer to the
callback registration function. I want this function pointer to point to a
function that an RB user can write custom code for in their REALbasic app.
I've done this before in pure RB code, by creating a module with a
globally-accessible method, and calling the callback creator from RB code
via declares, using "AddressOf theModuleMethod" as the function pointer.
But, I'm not sure how to achieve the same thing from a plugin...
Dave.
> From: "Joseph J. Strout" <joe at strout dot net>
> Reply-To: REALbasic Plugins <realbasic-plugins at lists dot realsoftware dot
> com>
> Date: Fri, 21 Apr 2006 10:54:04 -0600
> To: REALbasic Plugins <realbasic-plugins at lists dot realsoftware dot com>
> Subject: Re: Trying to call a class event via a callback
>
> At 5:41 PM +0100 4/21/06, Dave Addey wrote:
>
>> I'm trying to add a new event to a class, and then call that event by
>> installing a callback (using part of the Mac OS IOKit).
>
> Ow! :) As you found, you can't do that. Events can ONLY be called
> from the class where they are defined.
>
> Moreover, how would IOKit know to pass in the object reference that
> is any class method's first parameter?
>
>> Is this the same case from within a plugin too? If so, is there a way for
>> me to define a global module method from within the plugin, which would be
>> called (in RB) by the callback?
>
> Sure, why not? I'm not sure I understand this question. Defining
> global methods is demonstrated by most of the plugin samples.
>
> Best,
> - Joe
>
> --
>
> Joseph J. Strout
> joe at strout dot net
> _______________________________________________
> Unsubscribe or switch delivery mode:
> <http://www.realsoftware.com/support/listmanager/>
>
> Search the archives of this list here:
> <http://support.realsoftware.com/listarchives/lists.html>
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
|