delphi调C++的DLL的问题 ( 积分: 50 )

I

idecl

Unregistered / Unconfirmed
GUEST, unregistred user!
-------------------------------------
Microsoft Visual C++ Debug Library
---------------------------
Debug Assertion Failed!
Program: D:/Program Files/Borland/Delphi7/Projects/client/client.exe
File: dbgheap.c
Line: 1038
Expression: pHead->nLine == IGNORE_LINE &&
pHead->lRequest == IGNORE_REQ
For information on how your program can cause an assertion
failure, see the Visual C++do
cumentation on asserts.
(Press Retry to debug the application)
---------------------------
终止(A) 重试(R) 忽略(I)
--------------------------------------------
我用delphi7 调用C++的DLL文件,报以为错,请问是为什么?
delphi中声明了C++头文件中的结构构,回调函数等
 
你调用的是不是debug版本的dll?
debug版本只有在调试dll时才好用.
如果是调试调用程序,要用release版本的dll
 
声明不对呗,得再仔细检查你的声明才行
 
看看你的声明 注意 C++的数据结构和D的有些不一样的 比如C++就没有string 都用的pchar转化下
 
声明和C++头文件里的完全一致
只是C++里的struct中用到了继承,我转换里用的record,并把继承的直接复制过来了
比如
----------------------------------
c++
----------------------------------
struct CPTTCISecInfoField
{
//金融工具 代码ID
TPTTCIVarChar16 m_strSecID;
//金融工具 金融工具类型ID
TPTTCIVarChar16 m_strSecType;
//金融工具 市场ID
TPTTCIVarChar16 m_strExch;
};
struct CPTTCIVStatPosUnionInfoField : public CPTTCISecInfoField
{
//账户ID
TPTTCIVarChar16 m_strFundID;
//薄记日期
TPTTCIDate m_strBookDate;
//金融工具 多空类型
TPTTCIVarChar16 m_strLSType;
......
}
------------------------------------------
delphi 我转成如下格式
------------------------------------------
CPTTCISecInfoField = record
//金融工具 代码ID
m_strSecID : TPTTCIVarChar16;
//金融工具 金融工具类型ID
m_strSecType : TPTTCIVarChar16;
//金融工具 市场ID
m_strExch : TPTTCIVarChar16;
end;

CPTTCIVStatPosUnionInfoField = record
m_secifo : CPTTCISecInfoField;
m_strFundID : TPTTCIVarChar16 ;
//账户ID
m_strBookDate : TPTTCIDate ;
//薄记日期
m_strLSType : TPTTCIVarChar16 ;
//金融工具 多空类型
m_strSAType : TPTTCIVarChar16 ;
//金融工具 投保类型
。。。。。。
end;
 
发布与调用有没有使用stdcall关键字
 
to hupeh,有,发布和调用都用了STDCALL
 
对了,程序在运行时偶尔出错,在程序退出时,出错的机率要大,但是也只是弹出这个对话框,程序本身不错其他错误,在调试环境下也不报其他的错。
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
I
回复
0
查看
591
import
I
I
回复
0
查看
690
import
I
顶部