加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

delphi – ‘cdecl = nil'(在函数声明后放置)是什么意思?

发布时间:2020-12-15 09:49:24 所属栏目:大数据 来源:网络整理
导读:从优秀的Detour图书馆查看 demo source: implementation{$R *.dfm}var TrampolineGetMemory: function(Size: NativeInt): Pointer;cdecl = nil; 请看cdecl = nil;声明.在这种情况下它意味着什么? 注意 – 我已经知道cdecl代表一个调用约定. 解决方法 这只
从优秀的Detour图书馆查看 demo source:

implementation

{$R *.dfm}

var
  TrampolineGetMemory: function(Size: NativeInt): Pointer;
cdecl = nil;

请看cdecl = nil;声明.在这种情况下它意味着什么?

注意 – 我已经知道cdecl代表一个调用约定.

解决方法

这只是初始化变量的另一种方法.例如:

program Project1;

{$APPTYPE CONSOLE}

var
  i : integer = 5;
begin
  WriteLn(i);
  ReadLn;
end.

如果它写在一行上可能会更清楚

var
  TrampolineGetMemory: function(Size: NativeInt): Pointer; cdecl = nil;

或者如果定义了类型,甚至可能更好:

type
  TTrampolineGetMemory = function(Size: NativeInt): Pointer; cdecl;

//... 
 var
   TrampolineGetMemory: TTrampolineGetMemory = nil;

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读