Board index » delphi » Overlay procedure adressing

Overlay procedure adressing

Hi. I have got problems with defining procedure adresses when they are
loaded from an OVERLAY. The adress operator or the addr functions return an
adress but it does not point to the nesessary location. I have tried to use
the offset part, the functions mentioned above return, and the overlay
buffer address as the segment. But this technique does not give stable
results. If anyone knows how the overlay Pascal management works write me
back.

 

Re:Overlay procedure adressing


On Mon, 18 May 1998 16:16:46 +0300, "Zygin Sergey" <s...@gts.lg.ua>
wrote:

Quote
>Hi. I have got problems with defining procedure adresses when they are
>loaded from an OVERLAY. The adress operator or the addr functions return an
>adress but it does not point to the nesessary location.

This is true. The address operator if applied to an overlaid
function/procedure does not give litterally the address of the
procedure's code because this address is not known to the program even
at run time - only at 'call' time it is known to the overlay manager.
@proc points to a table entry of the form

        INT $3F, offset

which is a jump into the overlay manager's code who will redirect the
call to the correct location. A _call_ to the procedure will work
under all circumstances I ever tested. However, accessing the code via
@proc used as a data pointer will not work for obvious reasons.

Example:

Quote
>--x.pas-----------------<

{$O+}
unit x;
interface
procedure ox;
implementation
procedure ox;
begin writeln('hello') end;
end.

Quote
>------------------------<
>---otest.pas------------<

uses overlay,x;
var
  p:pointer;
begin
  overinit('otest.ovr');
  p:=@ox;
  asm
    call p
  end
end.

Quote
>-------------------------<

Even an indirect call via BASM will work as expected.

Can you give a short example which doesn't work as you would expect ?

Regards
Horst

 *** Las orillas del Nahuel Huapi ***

Other Threads