Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7553749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T11:08:45+00:00 2026-05-30T11:08:45+00:00

To better explain what I’m trying to accomplish, I’m going to start with something

  • 0

To better explain what I’m trying to accomplish, I’m going to start with something that works.

Say we have a procedure that can call another procedure and pass a string parameter to it:

procedure CallSaySomething(AProc: Pointer; const AValue: string);
var
  LAddr: Integer;
begin
  LAddr := Integer(PChar(AValue));
  asm
    MOV EAX, LAddr
    CALL AProc;
  end;
end;

This is the procedure that we will call:

procedure SaySomething(const AValue: string);
begin
  ShowMessage( AValue );
end;

Now I can call SaySomething like so(tested and works (: ):

CallSaySomething(@SaySomething, 'Morning people!');

My question is, how can I achieve similar functionality, but this time SaySomething should be a method:

type
  TMyObj = class
  public
    procedure SaySomething(const AValue: string); // calls show message by passing AValue
  end;

so, if you’re still with me…, my goal is to get to a procedure similar to:

procedure CallMyObj(AObjInstance, AObjMethod: Pointer; const AValue: string);
begin
  asm
    // here is where I need help...
  end;
end;

I’ve gave it quite a few shots, but my assembly knowledge is limited.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T11:08:46+00:00Added an answer on May 30, 2026 at 11:08 am

    what is the reason to use asm?

    when you are calling objects method, then instance pointer have to be the first parameter in method call

    program Project1;
    {$APPTYPE CONSOLE}
    {$R *.res}
    
    uses System.SysUtils;
    type
        TTest = class
            procedure test(x : integer);
        end;
    
    procedure TTest.test(x: integer);
    begin
        writeln(x);
    end;
    
    procedure CallObjMethod(data, code : pointer; value : integer);
    begin
        asm
            mov eax, data;
            mov edx, value;
            call code;
        end;
    end;
    
    var t : TTest;
    
    begin
        t := TTest.Create();
        try
            CallObjMethod(t, @TTest.test, 2);
        except
        end;
        readln;
    end.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Note I have completely re-written my original post to better explain the issue I
I have Bitnami Rails stack installed on my Mac. To better explain my problem
i am trying to create slider movement graphics. The code explain better this. using
The title is not very clear, so I'll try to explain better. I have
Sorry for the bad heading but I couldnt explain it better. im trying to
I'm having troubles releasing objects.. To explain it better I have included my code
World's most convuluted title I know, an example should explain it better. I have
To better explain what I'm trying to achieve, here's a simple example: Scenario 1
To better explain this I'll use Doodle Jump as an example. Assuming that the
I can better explain it with Raw script. <script> $(document).ready(function () { $(Div). //lock

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.