1. memory locations of atoms and sequences

------=_NextPart_000_0019_01BF6800.07EB19C0
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi all,

Does anyone know if it is possible to get the memory location of =
Euphoria atoms and sequences? Calling DLL functions often seems to =
require pointers to arrays that would be nice if you could pass the =
pointer to a sequence instead. At the moment, creating the sequence and =
then peeking and poking the values into the memory at a certain location =
for the DLL seems to be the only way to do it. Any ideas??

Many thanks (hope this question Isn't really stupid!)=20

------=_NextPart_000_0019_01BF6800.07EB19C0
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">
<HTML>
<HEAD>

<META content=3Dtext/html;charset=3Diso-8859-1 =
http-equiv=3DContent-Type>
<META content=3D'"MSHTML 4.72.3110.7"' name=3DGENERATOR>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT color=3D#000000 size=3D2>Hi all,</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT color=3D#000000 size=3D2>Does anyone know if it is possible =
to get the=20
memory location of Euphoria atoms and sequences? Calling DLL functions =
often=20
seems to require pointers to arrays that would be nice if you could pass =
the=20
pointer to a sequence instead. At the moment, creating the sequence and =
then=20
peeking and poking the values into the memory at a certain location for =
the DLL=20
seems to be the only way to do it. Any ideas??</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT color=3D#000000 size=3D2>Many thanks (hope this question =
Isn't really=20

------=_NextPart_000_0019_01BF6800.07EB19C0--

new topic     » topic index » view message » categorize

2. Re: memory locations of atoms and sequences

Mark Brown writes:
> Does anyone know if it is possible to get the memory
> location of Euphoria atoms and sequences?

This is a reasonable question. The answer is no.
Here's how I answered a couple of other people
who asked about it:

Bernie Ryan writes:
> Why is it so difficult for Euphoria to return the
> address of a variable ?

It isn't difficult. It's just a really bad idea
for many other reasons. Here's my post on this
subject from a few weeks ago...

Nick Metcalfe writes:
> It occured to me some time ago that a new function
> for DOS/Win? Euphoria that returns pointers to variables in
> memory like BASIC's VARPTR() would allow for some
> serious performance improvements when using
> embedded assembler or virtual screens in programs.

This has been suggested before from time to time.
On the surface it may sound like a good idea. However
it will probably never be implemented because:

   - It would force me to freeze the current internal format for data.
     This format has changed many times, leading to enhanced
     performance, and change was only possible because no
     program depends on the format.

  - It would open a "Pandora's Box" of evil code that would
    access and alter variables in ugly and invisible ways.
    You'd see a lot of unexplained crashes and weird behavior,
    that would tend to be blamed on Euphoria itself.

  - It would reveal proprietary information that might
    help the competition to make faster interpreters
    (Rebol 44x slower?, Perl 34x slower? Python 34x slower?)

  - A variable's value is not always stored at the same place.
    A fixed varptr address is not that meaningful in the context of
    garbage collection etc.

  - You wouldn't get the full speed-up that you imagine.
     The machine code would have some of the same
     overheads as the interpreter when reading the
     internal format.

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

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

Search



Quick Links

User menu

Not signed in.

Misc Menu