1. define_c_func/proc question

If define_c_func() is called several times for the same {dll,name} or 
{{},address} pair, will the same routine_id be returned? 

RC: could you include this precision in the docs? It's useful to know
when you want a custom message to call an user-supplied callback to pass the 
results back.

Also, could you consider extending allocate() and free() to sequences? The 
extended routines would return or free a sequence of addresses.

CChris

new topic     » topic index » view message » categorize

2. Re: define_c_func/proc question

CChris wrote:
> If define_c_func() is called several times for the same {dll,name} or 
> {{},address} pair, will the same routine_id be returned? 

No, you'll get a different routine id each time.

In contrast, routine_id() will give you the same id
each time for the same Euphoria routine. In the case of
Euphoria routines, it was easy to check if a routine already
had an id assigned to it.

For most programs, it doesn't matter, because the routine id
is only derived once.
 
> RC: could you include this precision in the docs? It's useful to know
> when you want a custom message to call an user-supplied callback to pass the
> 
> results back.

OK. 
I'm always a bit leary of documenting minor details like this,
since it more or less commits me to never changing how it
works in the future, but I guess I can commit to this.

> Also, could you consider extending allocate() and free() to sequences? The 
> extended routines would return or free a sequence of addresses.

I really don't see much demand for this.
It would be easy for you to make your own routines for this,
or just write a simple for-loop.

Regards,
   Rob Craig
   Rapid Deployment Software
   http://www.RapidEuphoria.com

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

3. Re: define_c_func/proc question

Robert Craig wrote:
> 
> CChris wrote:
> > If define_c_func() is called several times for the same {dll,name} or 
> > {{},address} pair, will the same routine_id be returned? 
> 
> No, you'll get a different routine id each time.
> 
> In contrast, routine_id() will give you the same id
> each time for the same Euphoria routine. In the case of
> Euphoria routines, it was easy to check if a routine already
> had an id assigned to it.
> 
> For most programs, it doesn't matter, because the routine id
> is only derived once.

In the case at hand, the issue is with defining multiple ids for an user 
defined routine whose address is passed to an EUphoria routine through a 
custom Windows message. The Eu routine needs to go through this in order
to call the user back and send it the required data which may be a sequence 
more complex than a plain string.

Checking the passed pair of arguments against an ever growing list of already
processsed calls doesn't appear to be very difficult or performance 
penalising.
Or I missed something...

>  
> > RC: could you include this precision in the docs? It's useful to know
> > when you want a custom message to call an user-supplied callback to pass the
> > 
> > results back.
> 
> OK. 
> I'm always a bit leary of documenting minor details like this,
> since it more or less commits me to never changing how it
> works in the future, but I guess I can commit to this.
> 

Just say that define_c_func() may return different ids. And you'll change 
that the day where you'll be sure to return an unique id, which may never 
come. Thys the coder will know s/he may have to handle different returned 
ids, and hence will.

> > Also, could you consider extending allocate() and free() to sequences? The 
> > extended routines would return or free a sequence of addresses.
> 
> I really don't see much demand for this.
> It would be easy for you to make your own routines for this,
> or just write a simple for-loop.
> 

Of course. Just a convenience, and more in line with most Eu routines 
processing sequences transparently.

CChris

> Regards,
>    Rob Craig
>    Rapid Deployment Software
>    <a href="http://www.RapidEuphoria.com">http://www.RapidEuphoria.com</a>

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

Search



Quick Links

User menu

Not signed in.

Misc Menu