function InStr(SourceStr:PChar;Ch:Char):integer;
  stdcall;external '*.dll';

解决方案 »

  1.   

    Index 1 是你有多个函数时,可以用顺序代替,不过一般不用
    你好象没有引用dll单元啊
      

  2.   

    implementation
     function InStr(SourceStr:PChar;Ch:Char):integer;
       stdcall;external 'StrOperation.dll';
      

  3.   

    implementation
     function InStr(SourceStr:PChar;Ch:Char):integer;
       stdcall;external 'StrOperation.dll';
      

  4.   

    不对啊,按照 yopeng(小混混)和 anxue(totoro) 。
    程序就不认识SourceStr了。。
    还有就是resident是什么意思??
    HELP里没有
    大家帮忙~!~
      

  5.   

    library StrOperation;//(DLL文件)
    uses
      SysUtils,
      Classes;
    function InStr(SourceStr:PChar;Ch:Char):integer;stdcall;
      var
        Len,i:Integer;
      begin
        Len := strlen(SourceStr);
        for i := 0 to len-1 do
            if SourceStr[i] = ch then
            begin
                Result := i;
                Exit;
            end;
            Result := -1;
        end;    exports
            Instr name 'MyInStr'; //Index 1;//  resident;
    //(这里的INDEX和resident到底是什么意思,我照书上一加就错)
    begin
    end.
    //调用
    unit Unit2;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,Dialogs, StdCtrls;
    function InStr(SourceStr:PChar;Ch:Char):integer;
       stdcall;external 'StrOperation.dll';
    var
      Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
    var
      order : Integer;
      txt   : PChar;
      PFunc : TFarProc;
      Moudle: THandle;
    begin
        Moudle := Loadlibrary(绝对路径);
        if Moudle > 32 then
        begin
            Pfunc := GetProcAddress(Moudle,'Instr');
            txt := StrAlloc(80);
            txt := StrPCopy(txt,Edit1.Text);
            Order := TInStr(@Pfunc.txt,@Edit2.txt);//这里不认识DLL里的函数
            Freelibrary(Moudle);
        end;
    end;
    end.
      

  6.   

    对不起,忘了看你的定义了
    这里应该是
    Order := TInStr(txt,Pchar(Edit2.txt));//这里不认识DLL里的函数
      

  7.   

    既然是dll当然不用引入拉,要想引用需要在程序头调入dll,然后用函数指针调用某个函数就可以,具体怎么写我不记得了,查一下资料可以解决。
      

  8.   

    //首先定义需要调用的函数
    type  function InStr(SourceStr:PChar;Ch:Char):integer;stdcall;
    //然后取得dll的句柄 
    Moudle := Loadlibrary(绝对路径\x.dll);if Moudle > 32 then
    begin
      //取得函数地址
      Pfunc := GetProcAddress(Moudle,'Instr');
      txt := StrAlloc(80);
      txt := StrPCopy(txt,Edit1.Text);
      Order := TInStr(@Pfunc.txt,@Edit2.txt);//这里不认识DLL里的函数
      Freelibrary(Moudle);
    end;
      

  9.   

    几点建议:
    1。如果静态引入dll文件中的函数,需要在函数引用时用function InStr
    SourceStr:PChar;Ch:Char):integer;
       stdcall;external 'StrOperation.dll';
    2。如果动态的引入函数,可以通过定义一个类型function(有待确定),象调用过程一样。
      

  10.   

    Order := TInStr(txt,Pchar(Edit2.txt));//这里不认识DLL里的函数需要定义tinstr
    type 
    TINStr=function(source:pchar;check:char):integer;