dll中定义了一个函数,如下有几个情况搞不清,现在举例如下
1、function func1(p1:PChar='123';p2:Integer=1):integer;stdcall;编译时提示[Error] Project2.dpr(18): Constant expression expected
2、function func1(p1:PChar;p2:Integer=1):integer;stdcall;可以编译通过,但在函数体中把p2的值show出来时,都不是想要的结果,在exe中是正常的
真是太怪了!!!
1、function func1(p1:PChar='123';p2:Integer=1):integer;stdcall;编译时提示[Error] Project2.dpr(18): Constant expression expected
2、function func1(p1:PChar;p2:Integer=1):integer;stdcall;可以编译通过,但在函数体中把p2的值show出来时,都不是想要的结果,在exe中是正常的
真是太怪了!!!
2、function func1(p1:PChar;p2:Integer=1):integer;stdcall;
你在dll定义函数的时候设置了默认值了,在主程序里调用dll时,
function func1(p1:PChar;p2:Integer=1):integer;stdcall; external 'a.dll';
这儿也要加默认值