DCC 无法决定函数需要的参数数量
我在具有此原型的单元中声明了一个函数:
function MapFunction(process: THANDLE; func: Pointer; size: Cardinal) : Pointer;
并且我用以下方式调用它:
stub := MapFunction(proc, remoteStub, 80);
当我编译时,我收到此错误,该错误停止编译:
[DCC错误] test.pas(22): E2035 实际参数不足
我摆弄了它一段时间,只是决定添加更多参数来看看它在想什么。所以我这样称呼它:
stub := MapFunction(proc, remoteStub, 80, 1, 1, 1, 1, 1);
然后 DCC 通知我:
[DCC错误] test.pas(22): E2035 实际参数不足
[DCC错误] test.pas(22): E2034实际参数过多
注释掉该行可以使单元编译成功。
我只有一个问题:什么?
我还应该提到的是,remoteStub
是一个成员变量,并且此函数调用位于该类的成员内部。并且这个特定方法是模板方法。
I have a function declared in a unit with this prototype:
function MapFunction(process: THANDLE; func: Pointer; size: Cardinal) : Pointer;
and I am calling it with this:
stub := MapFunction(proc, remoteStub, 80);
When I compile I get this error which halts compilation:
[DCC Error] test.pas(22): E2035 Not enough actual parameters
I fiddled with it for a while and just decided to add more parameters to see what it was thinking. So I called it with this:
stub := MapFunction(proc, remoteStub, 80, 1, 1, 1, 1, 1);
And then DCC informs me that:
[DCC Error] test.pas(22): E2035 Not enough actual parameters
[DCC Error] test.pas(22): E2034 Too many actual parameters
And commenting out that line allows the unit to compile successfully.
I just have one question: What?
I should also mention that remoteStub
is a member variable and this function call is inside a member of that class. And that this particular method is a template method.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您报告该行:
导致两个错误:
唯一有意义的解释是:
remoteStub
是一个需要参数的函数或过程 - 第一个错误。以下代码的行为与您在问题和对 RRUZ 已删除答案的评论中报告的行为完全相同:
我想不出还有什么可以解释您报告的内容!
You report that the line:
results in two errors:
The only explanation that makes sense is that:
remoteStub
is a function or procedure which expects parameters – the first error.The following code behaves exactly as you report in your question and in comments to RRUZ's deleted answer:
I can't think what else could explain what you report!
确保您没有其他具有相同名称和不同签名的函数。
下面的代码给你一个
E2035没有足够的实际参数
Make sure that you don't have other functions with the same name and a different signature.
The code below gives you a
E2035 Not enough actual parameters