Re: Sequence-Atom-DLL
- Posted by Robert Craig <rds at RapidEuphoria.com> Jun 03, 2003
- 407 views
Derek Parnell wrote: > Just to clarify, does this also mean that 32-bit addresses might pose a > problem? And what about flags bits such as #8F12817F ? With 32 bits you can represent signed integers from -2 billion to +2 billion roughly. Euphoria (currently) treats only -1 billion to + 1 billion as integers, and anything outside that range is considered a handle of a floating-point number or sequence. So yes, you'd have to be careful with 32-bit addresses and high-magnitude integers when passing them *from a C program to a Euphoria .dll*. >> Someone who studied the internal representation of sequences, >> might be able to allocate and construct a sequence in C, >> and pass it in, but that's definitely not for the >> faint of heart. > > So normally we need to convert a sequence to some form of RAM structure > and pass an address instead? -- Derek Normally you would *not* be calling a Euphoria .dll routine from a C program. You'd be calling it from a Euphoria program (either interpreted or translated/compiled), in which case everything is simple and seamless - you just declare the parameters of the routine using E_INTEGER, E_ATOM, E_SEQUENCE or E_OBJECT and you can then pass whatever Euphoria data you like without worrying about addresses, 31 vs. 32 bits or any of that stuff. However, if you want to call a Euphoria .dll routine *from a C program*, you can pass 31-bit integers easily, but to pass a sequence, you would have to first construct it in memory, then pass its address. To be safe you'd have to pass the address as two 16-bit arguments to avoid the "31-bit" problem. I expect that the vast majority of people will want to call Euphoria .dll's from Euphoria programs. Those people need not be concerned about 31 vs 32 bits etc. They can pass and receive back atoms and complex sequences of any size or shape, without worrying about how things are implemented at the bit-level. Regards, Rob Craig Rapid Deployment Software http://www.RapidEuphoria.com