zoukankan      html  css  js  c++  java
  • dll pansichar 报错

    library dll10;
     
    { 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
    System.ShareMem,
    System.SysUtils,
    System.Classes,
    Soap.InvokeRegistry,
    Soap.SOAPHTTPClient,
    System.Types,
    Soap.XSBuiltIns,
    n_socialwebservice in 'n_socialwebservice.pas';
     
    {$R *.res}
    function dllstr(const input: PAnsiChar; var output: PAnsiChar): Integer; stdcall;
    begin
    StrCopy(output, input);
    Result := 1;
    end;
     
    function getexamine(const as_type: PAnsiChar; const as_code: PAnsiChar; var as_sresult: PAnsiChar; var as_smessage: PAnsiChar): SmallInt; stdcall;
    var
    ahttp: THTTPRIO;
    s3, s4: string;
    s5, s6: PAnsiChar;
    begin
    try
    ahttp := THTTPRIO.Create(nil);
    ahttp.URL := 'http://218.7.121.38:11111/socialwebservice/n_socialwebservice.asmx';
    ahttp.Service := 'n_socialwebservice';
    ahttp.Port := 'n_socialwebserviceSoap';
    s3 := '';
    s4 := '';
    Result := (ahttp as n_socialwebserviceSoap).of_getexamine(StrPas(as_type), StrPas(as_code), s3, s4);
    // s5 := PAnsiChar(AnsiString(s3));
    // s6 := PAnsiChar(AnsiString(s4));
    //重要
    StrCopy(as_sresult, PAnsiChar(AnsiString(s3)));
    StrCopy(as_smessage, PAnsiChar(AnsiString(s4)));
    Result := 1;
    finally
    // FreeAndNil(ahttp);
    end;
    end;
     
    exports
    dllstr,
    getexamine;
     
    begin
     
    end.
     
     
    initialization
    Coinitialize(nil);
    finalization
    CoUninitialize;
    -----------------------------------------------------------------------------------
    主调用
    -----------------------------------------------------------------------------------
     
    procedure TForm1.btn2Click(Sender: TObject);
    var
    s, s1: PAnsiChar;
    begin
    try
    //重要
    GetMem(s, 1024);
    GetMem(s1, 255);
    getexamine(PAnsiChar(edt1.Text), PAnsiChar(''), s, s1);
    //重要
    mmo1.Text := s;
    edt2.Text := s;
     
    finally
    FreeMem(s);
    FreeMem(s1);
    end;
    end;
     

  • 相关阅读:
    es手动创建索引,修改索引,删除索引
    es的scoll滚动查询技术
    es倒排索引和正排索引
    linux中按照指定内容查找文件
    es定制排序搜索结果
    es中如何定位不合法搜索
    es中filter和query的对比
    es组合多个条件进行查询
    手动建立mapping以及增加属性
    30分钟学会如何使用Shiro
  • 原文地址:https://www.cnblogs.com/maweiwei/p/13728311.html
Copyright © 2011-2022 走看看