Delphi中使用@取函数地址的问题
来源:互联网 发布:技嘉主板 知乎 编辑:程序博客网 时间:2024/05/17 01:20
例如以下代码:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,Dialogs;
type
TForm1 = class(TForm)
procedure one();
function two(x,y:integer):integer;
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.one();
var
p : pointer;
begin
p:=@two;
end;
function TForm1.two(x,y:integer):integer;
begin
Result:=x+y;
end;
end.
在Delphi5中,没有任何问题,到了delphi7、2007、2009中就会报错:需要变量(Delphi6没试)
原因是新版本中要求返回函数地址的函数必须是全局函数,所以程序要改成这样:
................................
var
Form1: TForm1;
function two(x,y:integer):integer;
................................
function two(x,y:integer):integer;
- Delphi中使用@取函数地址的问题
- Delphi中使用汇编(关于POS函数的问题)
- 函数取地址与复制构造函数的使用
- Delphi 中取本机的计算机名、IP地址、Windows登录的用户名
- php 取地址&符号使用遇到的一个问题
- Delphi中分隔字符串函数的使用
- Delphi中函数指针的使用
- delphi中函数指针的使用
- Delphi中GetTickCount函数的使用
- delphi中TQueue的使用问题
- Delphi中颜色取值问题,解决小技巧(Delphi)
- Delphi取整函数
- Delphi取整函数
- Delphi取整函数
- Delphi取整函数
- delphi取整函数
- Delphi取整函数
- 函数的参数调用 取地址
- 群龙无首,必成散沙。
- 撒谎带来的烦恼
- 知识如大海......
- 秒杀竞拍屡创网络神话:馅饼还是美丽陷阱
- 开博
- Delphi中使用@取函数地址的问题
- SQL 语句性能调优 初级篇 —— 简单查询语句的调优
- 真正理会了需要就是动力
- CRM热潮中的冷思考:风光的背后隐藏什么?
- hi,am 9527
- C/C++问题征集
- Android界面元素的层次关系(译)
- 2009年过去了,我们流泪怀念它
- Visual Studio 2010 RC正式发布 - 模型和CUIT工程需要升级 + KB980610 + KB980920补丁包