function login(name:string;pwd:string):boolean;stdcall; //需要发布的方法
end;
implementation
initialization
invregistry.registerinterface(typeinfo(imytest));
end.
mytestimpl.pas接口实现文件内容:
unit mytestimpl;
interface
uses invokeregistry, types, xsbuiltins, mytestintf;
type
tmytest = class(tinvokableclass, imytest)
public
function login(name:string;pwd:string):boolean;stdcall;
end;
implementation
{ tmytest }
function tmytest.login(name, pwd: string): boolean; //自己定义的方法的实现代码
begin
if ((name='1') and (pwd='abc')) then
result:=true
else
result:=false;
end;
initialization
invregistry.registerinvokableclass(tmytest);