1. RE: Eu's good design

jbrown105 at speedymail.org wrote:
> 
> 
> On Mon, Aug 18, 2003 at 10:48:46PM +0000, Al Getz wrote:
> > 
> > 
> > Hello there,
> > 
> > Might be worth mentioning a few good points too...
> > 
> 
> > 2.  Ability to call virtual functions
> 
> I don't see how that can be done (at best merely emulated via routine 
> ids).

Hello again jbrown,

Im not sure what you mean here?  Also, Rob is looking into
more ways of doing this also.

Take care for now,
Al

new topic     » topic index » view message » categorize

2. RE: Eu's good design

> From: jbrown105 at speedymail.org [mailto:jbrown105 at speedymail.org]

> On Mon, Aug 18, 2003 at 10:48:46PM +0000, Al Getz wrote:

> > 2.  Ability to call virtual functions
> 
> I don't see how that can be done (at best merely emulated via 
> routine ids).

I think he means real C++ style virtual functions.  Although we could debate
your use of 'emulated'.  The original win32lib method of connecting event
handlers was as close to virtual functions as anything.

Matt Lewis

new topic     » goto parent     » topic index » view message » categorize

3. RE: Eu's good design

jbrown105 at speedymail.org wrote:
> 
> 
> On Tue, Aug 19, 2003 at 07:38:20AM +0000, Al Getz wrote:
> > > > 2.  Ability to call virtual functions
> > > 
> > > I don't see how that can be done (at best merely emulated via routine 
> > > ids).
> > 
> > Hello again jbrown,
> > 
> > Im not sure what you mean here?  Also, Rob is looking into
> > more ways of doing this also.
> > 
> > Take care for now,
> > Al
> > 
> 
> Well, how would you call a virtual function in Euphoria?
> 
> jbrown
> 
> -- 
>  /"\  ASCII ribbon              | http://www.geocities.com/jbrown1050/
>  \ /  campain against           | Linux User:190064
>   X   HTML in e-mail and        | Linux Machine:84163
>  /*\  news, and unneeded MIME   | http://verify.stanford.edu/evote.html
> 
> 

Hello there jbrown,

For example...


include dll.e
RoutineName = define_c_func( {}, RoutineMemAddress, {C_POINTER}, C_LONG)

--Then you can call it via c_func:

atom retv
retv=c_func(RoutineName,{Params})

Rob said he was thinking of a way to 'undefine' the c func
too in case you dont need that particular routine any longer.

It works pretty good for fairly static methods that will
probably be used throughout the program instances life.

Take care for now,
Al

new topic     » goto parent     » topic index » view message » categorize

4. RE: Eu's good design

Al Getz wrote:
> 
> jbrown105 at speedymail.org wrote:
> >
> > Well, how would you call a virtual function in Euphoria?
>
> For example...
> 
> 
> include dll.e
> RoutineName = define_c_func( {}, RoutineMemAddress, {C_POINTER}, 
> C_LONG)
> 
> --Then you can call it via c_func:
> 
> atom retv
> retv=c_func(RoutineName,{Params})
> 
> Rob said he was thinking of a way to 'undefine' the c func
> too in case you dont need that particular routine any longer.
> 
> It works pretty good for fairly static methods that will
> probably be used throughout the program instances life.

It's also possible to do it using fptr.e in a truly dynamic way:

ok = call_cdecl(peek4u(peek4u(this)+func_offset), {this, arg1, arg2})

Because technically, you should be looking up the function in the 
object's virtual function table (this is how C++ compilers do it) 
because it could be overridden.

Matt Lewis

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu