delphi调用vc的dll的函数不能返回参数??

delphi调用vc的dll的函数不能返回参数??,第1张

完全可以VC中的char * 完全可对应delphi的Pchar.function funcXXXX(): BooleanStdCall export我以前还试过Delphi的DLL函数反回值是一个构造、指针,都可以被VC精确调用。别的涉及字符串时,在Delphi中最好应用定长的字符数组,实袈滟不可再用PChar其它类型我试过float和byte型在VC和delphi中参数传递会有问题,所以避免应用。

Num := BaseEncode(PChar(ss), PChar(Res))是这一行出现问题吗?试着修改为:Num := BaseEncode(ss, Res)

如果是Edit1.Text := Res这一行,则修改为 Edit1.Text := string(Res)

你说明白啊,哪个地方报错?

StrDispose, 这个你不能使用,

Description

StrDispose is provided for backward compatibility only. StrDispose disposes of a string on a heap that was previously allocated with StrAlloc or StrNew.

If Str is nil, StrDispose does nothing.需要和StrAlloc或StrNew一起使用。

去掉最后2行,就可以了。

既然传入参数是地址,那你应该传入地址。。。

IPCAST_GetTermStatus(abuffer[0], @ptermsta)

声明也不对

pTerm:LPTermAttr 应该改为 delphi里的指针声明

pTerm:TermAttr (TermAttr = ^LPTermAttr)

还有一点是,你delphi的结构体和c++的那个大小并不一致,最后三个属性肯定不准


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/sjk/6705959.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-03-27
下一篇 2023-03-27

发表评论

登录后才能评论

评论列表(0条)

保存