1. Universal Routine Pointers

Does any one know if the routine pointers between
c-function/euphoria-routines are universal ?
I mean, when I already routine_id () -ed 2 euphoria routines, and then I
link a c-routine, is the number of the c-routine unique ?

Example:

    i1 = routine_id("something")                -- i1 will become 0
    i2 = routine_id ("something else")        -- i2 will become 1

Now, when I link a c-routine, will its pointer become 0 or 2 ?

I could try this myself, but for me, without any win32 knowledge, I have to
dig up some legal routine decleration, or hack some of the example programs.
Im assuming some here already know....

Ralf

new topic     » topic index » view message » categorize

2. Re: Universal Routine Pointers

Ralf writes:
> Does any one know if the routine pointers between
> c-function/euphoria-routines are universal ?
> I mean, when I already routine_id () -ed 2 euphoria routines, and then I
> link a c-routine, is the number of the c-routine unique ?

With the *current* implementation, the routine id numbers
increase independently for C routines vs. Euphoria routines.
You could have C routine #3 and Euphoria routine #3 at the
same time in your program.

I think it's bad programming practice to make assumptions
about the routine id values that Euphoria will return to you.
(You can only assume they are integers >= -1.)
Also, keep in mind that a routine id value, like 7, say, is not valid
until routine_id(), or define_c_func()/define_c_proc()
has been called, and has returned 7 to you. You can't skip
calling these routines, and just go ahead and start using the
value 7 in c_func/c_proc/call_func/call_proc/call_back. You'll
get a run-time error. Since you can't avoid calling these routines,
why not use the routine id that's returned, rather than trying to
"guess", or assume, what the routine id will be?

Regards,
     Rob Craig
     Rapid Deployment Software
     http://members.aol.com/FilesEu/

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

3. Re: Universal Routine Pointers

>Ralf writes:
>> Does any one know if the routine pointers between
>> c-function/euphoria-routines are universal ?
>> I mean, when I already routine_id () -ed 2 euphoria routines, and then I
>> link a c-routine, is the number of the c-routine unique ?

> practice to make assumptions
>about the routine id values that Euphoria will return to you.
>(You can only assume they are integers >= -1.)

I agree, the reason I was asking was because I wanted to create a
'universal' caller for all types of routines.
However as it seems, there are a number of problems to do this, so i'll give
up.
The first problem is that when I overwrite routine_id it wont work, due to
the scope differences.
And the second that I cant associate a certain type to a certain number of
the routine-id since those id's themselves are not unique. (in the way that
the routine id of an euphoria routine and a c routine might be the same)

It just seemed cleaner. Other alternatives will do as wel. Thanks for the
info.

Ralf

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

Search



Quick Links

User menu

Not signed in.

Misc Menu