改用类型变量,例如:
var
tds_accept : function(s: TSocket; addr: PSockAddr; addrlen: PInteger): TSocket; stdcall;
tds_getpeername : function(s: TSocket; var name: TSockAddr; var namelen: Integer): Integer; stdcall;
tds_getsockopt : function(s: TSocket; level, optname: Integer; optval: PAnsiChar; var optlen: Integer): Integer; stdcall;
tds_getsockname : function(s: TSocket; var name: TSockAddr; var namelen: Integer): Integer; stdcall;
tds_recvfrom : function(s: TSocket; var Buf; len, flags: Integer; var from: TSockAddr; var fromlen: Integer): Integer; stdcall;
initialization
tds_accept := accept;
tds_getpeername := getpeername;
tds_getsockopt := getsockopt;
tds_getsockname := getsockname;
tds_recvfrom := recvfrom;
或者:
type
lpfn_accept = function(s: TSocket; addr: PSockAddr; addrlen: PInteger): TSocket; stdcall;
lpfn_getpeername = function(s: TSocket; var name: TSockAddr; var namelen: Integer): Integer; stdcall;
lpfn_getsockopt = function(s: TSocket; level, optname: Integer; optval: PAnsiChar; var optlen: Integer): Integer; stdcall;
lpfn_getsockname = function(s: TSocket; var name: TSockAddr; var namelen: Integer): Integer; stdcall;
lpfn_recvfrom = function(s: TSocket; var Buf; len, flags: Integer; var from: TSockAddr; var fromlen: Integer): Integer; stdcall;
var
tds_accept : lpfn_accept = accept;
tds_getpeername : lpfn_getpeername = getpeername;
tds_getsockopt : lpfn_getsockopt = getsockopt;
tds_getsockname : lpfn_getsockname = getsockname;
tds_recvfrom : lpfn_recvfrom = recvfrom;