我编一个Dll如下:
可我用API调用时出错,原因可能我用了DCOM,可能COM没有初始化?
应该如何初始化呢?library Project2;{ Important note about DLL memory management: ShareMem must be the
  first unit in your library's USES clause AND your project's (select
  Project-View Source) USES clause if your DLL exports any procedures or
  functions that pass strings as parameters or function results. This
  applies to all strings passed to and from your DLL--even those that
  are nested in records and classes. ShareMem is the interface unit to
  the BORLNDMM.DLL shared memory manager, which must be deployed along
  with your DLL. To avoid using BORLNDMM.DLL, pass string information
  using PChar or ShortString parameters. }uses
  SysUtils,
  Classes,variants,windows,
  Unit1 in 'Unit1.pas' {dm: TDataModule};{$R *.res}function SendSMS(telno:string;msg:string):integer;stdcall;
var
   succ: integer;
   key: word;
   uid,pwd,session: OleVariant;
   MONumber: OleVariant;
begin
result:=0;
   try
     dm.BlocUserID:='user';
     dm.BlocUserPwd:='pass';
     dm.WebCon.Connected:=true;
     dm.WebCon.AppServer.GetKey(dm.olekey);
     key:=strtoint(dm.Decrypt(dm.olekey,54321));
     uid:=dm.Encrypt(dm.BlocUserID,key);
     pwd:=dm.Encrypt(dm.BlocUserPwd,key);
     dm.WebCon.AppServer.login(uid,pwd,dm.olekey,session,dm.BlocSendQuantity,succ);
   finally
//     dm.WebCon.Connected:=false;
   end;//try  case succ of
     0:result:=0;
     1:result:=1;
     2:result:=2;
     3:result:=3;
  end;//succ of  if succ=0 then
  begin
  dm.olesession:= session;
  MONumber:= VarArrayCreate([0,1],varVariant);
  MONumber[1]:=telno;
  dm.WebCon.AppServer.ClientSendSM(dm.olesession,dm.olekey,MONumber,msg,'10',succ);
       case succ of
       0: result:=0;
       1: result:=4;
       2: result:=5;
       3: result:=6;
       end; //case
  end;//if(succ==0);
  dm.WebCon.Connected:=false;
end;
exports
SendSMS name '_SendSMS';begin
MessageBox(0,'','',0);
end.