?
Solved

pascal syntax for a callback

Posted on 2000-01-25
2
Medium Priority
?
164 Views
Last Modified: 2010-04-04
what is the pascal syntax for declaring a pointer to a function and then calling the function from the pointer

procedure test(i : integer);
var
   x : ??? what is the type here.
begin
   x := @test;
   x(i);   ??? how is the procedure called
end;
0
Comment
Question by:calvinrsmith
2 Comments
 
LVL 12

Accepted Solution

by:
rwilson032697 earned 120 total points
ID: 2386555
Try this:

type
  TTestProc = procedure(i : Integer);

procedure test(i : integer);
var
   x : TTestProc;
begin
   x := @test;
   x(i);
end;

Don't wait up for it to return though :-)

Cheers,
Raymond.
0
 
LVL 1

Author Comment

by:calvinrsmith
ID: 2386619
Thanks again.  
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
This is an update to some code that someone else posted on Experts Exchange. It is an alternate approach, I think a little easier to use, & makes sure that things like the Task Bar will update.
This video tutorial shows you the steps to go through to set up what I believe to be the best email app on the android platform to read Exchange mail.  Get the app on your phone: The first step is to make sure you have the Samsung Email app on your …
In this video I will demonstrate how to set up Nine, which I now consider the best alternative email app to Touchdown.
Suggested Courses

589 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question