delphi 7中dll函数中的布尔参数
我有一个dll库。我已经排除了 delphi 类型的内存单元。
那么,函数声明的合适的 Boolean 类型是什么?
是 BOOL
还是其他什么?
问题在于方法签名中:
function Test(Param1: BOOL; Param2: BOOL; docContent: PCharArray): Integer;
当程序离开该函数时,我得到 AV。
我认为这是这两个第一个参数的数据类型的问题。
I have a dll library. I have excluded memory unit for delphi types.
In that way, what would be the appropriate Boolean
type for function declaration?
Is it BOOL
or something else?
The problem is that in the method signature:
function Test(Param1: BOOL; Param2: BOOL; docContent: PCharArray): Integer;
I get AV when program leaves that function.
I assume that it is the problem with the data type of these two first parameters.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
BOOL
适用于布尔类型。它是 Windows 类型,因此您将在 Windows.pas 中的所有函数中看到它。从 DLL 函数返回时的访问冲突通常表明您的调用约定错误 - 默认调用约定是
register
,但您可能需要stdcall
或cdecl< /代码>。将其添加到声明的末尾:
BOOL
is fine for Boolean types. It's a Windows type, so it's what you'll see in all the functions in Windows.pas.Access violations upon return from a DLL function often indicate that you have the calling convention wrong — the default calling convention is
register
, but you probably needstdcall
orcdecl
. Add it at the end of the declaration: