如果你要使用函数
在
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;type
TForm1 = class(TForm)
private
{ Private declarations }
public
{ Public declarations }
end;function add(x,y:integer):integer; stdcall; external 'dellcomserver.DLL';
function multi(x,y:integer):integer; stdcall; external 'dellcomserver.DLL';
//...其它的类同
var
Form1: TForm1;implementation{$R *.dfm}end.
在
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;type
TForm1 = class(TForm)
private
{ Private declarations }
public
{ Public declarations }
end;function add(x,y:integer):integer; stdcall; external 'dellcomserver.DLL';
function multi(x,y:integer):integer; stdcall; external 'dellcomserver.DLL';
//...其它的类同
var
Form1: TForm1;implementation{$R *.dfm}end.
类的声明必须要有实例的是否才可以,所以
type
Tcomp=class
public
public max(x,y:integer):integer;virtual;abstract;
public min(x,y:integer):integer;virtual;abstract;
end;定义私有变量
Tform1=class(Tform)
private
mycomp:tcomp;mycomp必须要在后面,否则编译器无法识别
begin
Result:=tcompimpl.create;
end;exports
add,multi,createcompimpl;
不好意思,我问个问题是关于上面的这段代码.dll可以返回windows的标准数据类型,但它可以返回一个对象吗??(如果可以返回一个对象,那如果我要在vb里调用你这个dll怎么办?)