D
dafuwengqing
Unregistered / Unconfirmed
GUEST, unregistred user!
调用C语言动态链接库遇到问题?请帮忙看看
implementation
function PrepareModify(answerfilenamechar;TotalMark:double):integer;
stdcall;external 'Read2.dll' name 'PrepareVBModify';
function ReadModify(sourcefilenamechar;SubjectNumber:integer):double;
stdcall;external 'Read2.dll' name 'ReadVBModify';
procedure TForm1.Button1Click(Sender: TObject);
var
p:integer;
count:double;
begin
p:=PrepareModify('D:/1.26/阅卷系统/VBM.ans',20);
if p=1 then
begin
count:=ReadModify('D:/1.26/阅卷系统/MODIFY.BAS',1);
showmessage(floattostr(count));
end;
end;
能正常运行但是逻辑上count应该为20而不是0,是不是c中的float在delphi中不能用double替代??
动态链接库头文件如下:
#ifndef READ2_H
#define READ2_H
#ifdef READ2_DLL
#define EXTERN __declspec(dllexport)
#else
#define EXTERN __declspec(dllimport)
#endif
//
extern "C"
EXTERN int PrepareVBModify(const char* lpszAnswerFileName,float fTotalMark);
//
extern "C"
EXTERN float ReadVBModify(const char* lpszSourceFileName,int iSubjectNumber);
#endif
implementation
function PrepareModify(answerfilenamechar;TotalMark:double):integer;
stdcall;external 'Read2.dll' name 'PrepareVBModify';
function ReadModify(sourcefilenamechar;SubjectNumber:integer):double;
stdcall;external 'Read2.dll' name 'ReadVBModify';
procedure TForm1.Button1Click(Sender: TObject);
var
p:integer;
count:double;
begin
p:=PrepareModify('D:/1.26/阅卷系统/VBM.ans',20);
if p=1 then
begin
count:=ReadModify('D:/1.26/阅卷系统/MODIFY.BAS',1);
showmessage(floattostr(count));
end;
end;
能正常运行但是逻辑上count应该为20而不是0,是不是c中的float在delphi中不能用double替代??
动态链接库头文件如下:
#ifndef READ2_H
#define READ2_H
#ifdef READ2_DLL
#define EXTERN __declspec(dllexport)
#else
#define EXTERN __declspec(dllimport)
#endif
//
extern "C"
EXTERN int PrepareVBModify(const char* lpszAnswerFileName,float fTotalMark);
//
extern "C"
EXTERN float ReadVBModify(const char* lpszSourceFileName,int iSubjectNumber);
#endif