private { Private declarations } public { Public declarations } end;
function EpoptInit() : Longint;stdcall;external 'testdll.dll';var Form1: TForm1;implementation
{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject); var ThreadId : DWord; iResult : Integer; i : Integer; arrayHandle : array[0..11] of THandle; begin iResult := EpoptInit();//此处出错了, if iResult <> 0 then begin exit; end;end;
#define __TESTOPT_H__#ifdef __cplusplus
extern "C" {
#endif
int WINAPI EpoptInit();#ifdef __cplusplus
}
#endif#endif
--------------#include "stdafx.h"
#include "stdio.h"
#include "stdlib.h"#include "testopt.h"
#include "windows.h"
#include "process.h"/************************************************************************/
/* 初始化函数 0 成功,-1失败 */
/************************************************************************/
int WINAPI EpoptInit()
{
int recResult = TAOecInit(NULL); //TAOecInit是另外厂商提供的,无法在跟踪了
if (recResult!=0)
{
g_bInit=false;
MakeErrCodeForRec("TAOecInit",ecResult);
return -1;
}
WriteLogFile("初始化ec成功!");
return 0;
}------------------
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls; {
function EpoptInit() : longint;stdcall;external 'testdll.dll';
}type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
function EpoptInit() : Longint;stdcall;external 'testdll.dll';var
Form1: TForm1;implementation
{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
var
ThreadId : DWord;
iResult : Integer;
i : Integer;
arrayHandle : array[0..11] of THandle;
begin
iResult := EpoptInit();//此处出错了,
if iResult <> 0 then
begin
exit;
end;end;
可能是这个的问题。把它们声明成一致的。
COM库:CoInitialize{Ex}、CoUnitialize
OLE系统:OleInitialize、OleUnitialize
在一般的c编译器中:
c 的 int类型 为16位整数
应该和
delphi的Smallint 相当.c的long类型 =D的longint类型.
是不是这里有问题?
Set8087CW(Default8087CW or $3F); 用于屏蔽CPU的浮点数被零除异常信息的。