Re: pointers to variables

new topic     » goto parent     » topic index » view thread      » older message » newer message
Lnettnay said...

Hi, all. I have returned to Euphoria after seven years of being distracted. Got to say I am thrilled by what has progressed in my absence! v2.1 was the big one back then.

Here's something I always wanted: direct access to the contents of Euphoria variables from within my assembly routines. Peeks and pokes are fine for shuffling small quantities of data back and forth but dent assembly performance with large data sets as they are (relative to assembler) quite slow, even with sequence operations. I think the good way to do this would be with a function to return the memory address of a Euphoria object that the assembly code could read or write directly. (who remembers the varptr() function from good ol` Basic?)

This is possible. If you're calling your routines via c_func/proc, use the E_* data types when defining them. The parameters will be passed with the 'raw' object values. The original use for this was for calling euphoria translated dlls, but you can use it in other ways. In wxEuphoria, for example, I directly manipulate euphoria objects using C.

Lnettnay said...

IIRC there is a suggestion that a function such as var_id() may be introduced. A further refinement to this may be along the lines of pointer = get_var_address(var_id(myvar)).

That's all I would need or want - just the pointer.

Yes, var_id() has been proposed. This might still happen in a future release, but not for 4.0. I doubt that the raw object value will be exposed, however.

Matt

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu