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

Delphi调用C++ DLL函数,有些类型相关的知识

发布时间:2020-12-15 09:57:39 所属栏目:大数据 来源:网络整理
导读:C++ 例: WIN32PROJECT1_API void test8(RECT a) { a.left = 1; a.top = 2; a.right = 3; a.bottom = 4; } 此时参数为 RECT a,在Delphi中有两种申明方式,各有不同 1、方式一var procedure test8(var a: TRect); cdecl; external Windll name 'test8'; 2、

C++ 例:

   WIN32PROJECT1_API void test8(RECT &a) {
	   a.left = 1;
	   a.top = 2;
	   a.right = 3;
	   a.bottom = 4;
   }

此时参数为 RECT &a,在Delphi中有两种申明方式,各有不同

1、方式一var

procedure test8(var a: TRect); cdecl; external Windll name 'test8';

2、方式const

procedure test8(const a: TRect); cdecl; external Windll name 'test8';
小知识:C++中以&的参数在Delphi必须以const或者var申明,否则会产生错误,这也是我亲试的结果。

(编辑:李大同)

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

    推荐文章
      热点阅读