realbasic-nug
[Top] [All Lists]

Re: Some questions about delegates

To: "REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>" <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: Some questions about delegates
From: Daniel Stenning <d0stenning at msn dot com>
Date: Fri, 30 Nov 2007 22:33:40 +0000
Delivered-to: listarchive at realsoftware dot com
Delivered-to: realbasic-nug at lists dot realsoftware dot com
Thread-index: AcgzoQ4jTPJUHp+UEdyR2gAbY5KfzA==
Thread-topic: Some questions about delegates
On 30/11/07 22:05, "Charles Yeomans" <charles at declareSub dot com> wrote:

> 
> Actually, this isn't quite right.  I think it's more accurate to say
> that when a delegate is converted to Ptr, any information about the
> object is stripped, and all that's left is the function pointer
> itself.  So you can pass an object method delegate to an external
> callback, but all that is passed is the function pointer,

I suspect that all RB class methods actually contain an invisible "this"
pointer argument - as per C++ ( and RB  plugins ) that points to the class
instance somehow, so if you ask RB to get the pointer to a method on a RB
class instance you are pointing to a function which contains an extra
argument that the external library which will call the callback isnt
expecting.  This is why you get crashes.

Of course using delegates to RB methods will be fine within RB itself.


>and you  
> can't go back.

More to the point - you'll get a crash. Well I certainly did.
> 
> Charles Yeomans
> _______________________________________________
> Unsubscribe or switch delivery mode:
> <http://www.realsoftware.com/support/listmanager/>
> 
> Search the archives:
> <http://support.realsoftware.com/listarchives/lists.html>
> 

Cheers,
Dan




_______________________________________________
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>