Книга знаний

Инф. технологии

Трансляция объектов в машинный код в Delphi

Автор статьи: romix | Редакторы:
Последняя редакция №3 от 08.02.07 | История
URL: http://kb.mista.ru/article.php?id=472

program ObjTest;
uses Windows;

type T_TEST = Class
  procedure test();
end;

procedure T_TEST.test();
begin
  MessageBox(0, 'test', 'test',0);
end;

var obj: T_TEST;
begin
  obj:=T_TEST.Create;
  obj.Test();
  obj.Test();
  obj.Free;
end.
mov eax, ebx
call 00403620
...
00403620: 
  push 00
  push 00403640; "test"
  push 00403640; "test"
  push 00
  call User32!MessageBoxA
  ret
program ObjTest; uses Windows; procedure test(); begin  MessageBox(0, 'test', 'test',0); end; begin  Test();  Test(); end.
mov eax, ebx
call 00401E90
...
00401E90: 
  push 00
  push 00403640; "test"
  push 00403640; "test"
  push 00
  call User32!MessageBoxA
  ret
program ObjTest;
uses Windows;

type T_TEST = Class
  function add(a,b: Integer):Integer;
end;

function T_TEST.add(a,b: Integer):Integer;
begin
  MessageBox(0, 'test', 'test',0);
  Result:=a+b;
end;

var obj: T_TEST;
begin
  obj:=T_TEST.Create;
  obj.add(2,3);
  obj.add(3,4);
  obj.Free;
end.
mov ecx, 00000004
mov edx, 00000003
mov eax, ebx
call 00403620
...
00403620: 
  push ebx
  push esi
  mov esi, ecx
  mov ebx, edx
  push 00
  push 00403640; "test"
  push 00403640; "test"
  push 00
  call User32!MessageBoxA
  lea eax, [ebx+esi]
  pop esi
  pop ebx
  ret

Описание | Рубрикатор | Поиск | ТелепатБот | Захваченные статьи | Установки | Форум
© Станислав Митичкин (Волшебник), 2005-2025 | Mista.ru

Яндекс.Метрика