请问如何将加密狗里面的用vc编成的obj封装成delphi编译的dll动态连接库,请大家帮帮忙啊,山穷水尽了,无尽痛苦之中!(175分)

  • 主题发起人 主题发起人 lpzst002
  • 开始时间 开始时间
L

lpzst002

Unregistered / Unconfirmed
GUEST, unregistred user!
我的代码如下,但里面有很多错误,请大家给我指点迷津
library Prodll;
uses
SysUtils,
Classes;
var
NetDogAddr: integer;
NetDogBytes: integer;
NetDogPassword: longint;
NetDogResult: longint;
NetDogData: ^byte;
NetDogHandle: ^longint;
doghandle: longint;
{$L nhdelphi.obj}
{$R *.res}
function NetDogLogin: longint; external;
function NetDogConvert: longint; external;
function NetDogRead: longint; external;
function NetDogLogout: longint; external;

Function DogLogin :Longint;stdcall;
var
I:Longint;
Begin
NetDogHandle := @doghandle;
NetDogPassword := 0;
I:=Netdoglogin();
Result:=0;
End;
Function DogLogOut:Longint;StdCall;
Begin
Result:=NetDogLogout;
End;
Function DogRead:longint;stdcall;
var
I,LongData:longint;
Begin
longData := 0;
NetDogData := @ longData;
NetDogBytes := 4;
NetDogAddr := 10;
Result:= NetDogRead();
End;
Function DogConvert(ConvertData:string):longint;stdcall;
var
dwRetCode:longint;
Begin
NetDogBytes := 6;
NetDogData := @ ConvertData[1];
dwRetCode := NetDogConvert();
Result:=NetDogResult;
End;
exports
DogLogin;
DogLogOut;
DogRead;
DogConvert;

begin
end.

obj的接口函数分别是
function NetDogLogin: longint; external;
function NetDogConvert: longint; external;
function NetDogRead: longint; external;
function NetDogLogout: longint; external;
但现在应该怎样将他们封装在dll里面呢,谢谢
NetDogAddr: integer;
NetDogBytes: integer;
NetDogPassword: longint;
NetDogResult: longint;
NetDogData: ^byte;
NetDogHandle: ^longint;
doghandle: longint;
这几个是obj里面的全程变量

 
用{$L yourOBJ.obj}装载,但很不幸,$L只能装载Borland C编译成的obj。
不过你可以用vc编一个dll封装该obj,然后给delphi调用。
 
接受答案了.
 
后退
顶部