Board index » delphi » Seg and Ofs in Delphi3

Seg and Ofs in Delphi3

I'm trying to port code from Turbo Pascal to Delphi3.

What Delphi functions are equivalent to the Seg command (gets the segment
address of an array) and the Ofs command (gets the offset address of an
array) in Turbo?

Thanks for your help.

 

Re:Seg and Ofs in Delphi3


Seg and Ofs only work with the segmented memory model in 16 bits. With
32 bit versions of Delphi, all addresses are a single 32 quantity.
You'll have to look closely at what the original code is doing. In some
cases, I've ported some code by replacing the Ofs function by the @
operator, but you really need to understand why Ofs is used in the first
place.

Best regards,

Michel
------
http://www.cam.org/~mibra/spider
Envision Image Library
Spider Object Database
Spider Container and Persistent Classes  (freeware)
WordShare string localization  (freeware)

Quote
Robert John Sample wrote:

> I'm trying to port code from Turbo Pascal to Delphi3.

> What Delphi functions are equivalent to the Seg command (gets the segment
> address of an array) and the Ofs command (gets the offset address of an
> array) in Turbo?

> Thanks for your help.

Re:Seg and Ofs in Delphi3


Im Artikel <37152E45.487F7...@mail.usask.ca>, Robert John Sample
<rjs...@mail.usask.ca> schreibt:

Quote
>What Delphi functions are equivalent to the Seg command

32 bit applications have no equivalents. There all addresses are 32 bit (4
byte) offsets into the address space of the instance. You can use Pointers
instead of separate Seg and Off values, e.g. @MyArray[0] is the address of the
first item in the MyArray array. Pointers should be used only for the data
portion of an array, not for the array itself, since an array can consist of
separate or at least incompatible array descriptions, and the data in a
possibly different memory area. Perhaps better solutions for your problem
exist, but then you should post some code, how the Seg and Off values are used
in your application.

DoDi

Other Threads