type
TIntFunc=function(i:integer):integer;stdcall;
 var
Th:Thandle;
Tf:TIntFunc;
//Tp:TFarProc;begin
  Th:=LoadLibrary('d:\dll3\dll3.dll');
   if Th>0 thentry@Tf:=GetProcAddress(Th,'Test');
//<:::::::::::::::::这里@tf总是nil,但是我的dll3.dll里确实有test这个函数啊
//我用静态调用都可以的:)
if @Tf<>nil then

解决方案 »

  1.   

    动态调用时
    Th:=LoadLibrary('d:\dll3\dll3');后面不要dll,否则他就找不到
      

  2.   

    你的DLL中的Test函数导出了吗???如果没有,在工程文件中加入以下的内容!!!具体参考Delphi的帮助!!!Exports
       test;
      

  3.   

    没人知道吗谁能给个动态调用的简单例子我自己找找看也可以哦,
    我是刚学DEPHI的哦,请大家帮忙拉
      

  4.   

    var
      funname : function(i:integer):integer;stdcall;
      hdll : Thandle;
    begin
        hdll := loadlibrary('dllname.dll');
        if hdll <= 0 then
        begin
          showmessage('load Fail');
         exit;
        end;
        funname := GetProcAddress(hdll,'调用函数名');
        if not Assigned(funname) then
        BEGIN
          showmessage('getprocaddress FAIL');
         exit;
        END;
    end;
      

  5.   

    type
    TIntFunc=function(i:integer):integer;stdcall;
     var
    Th:Thandle;
    Tf:TIntFunc;
    Tp:TFarProc;begin
      Th:=LoadLibrary('d:\dll3\dll3.dll');
       if Th>32 then
       begin
         Tp:=GetProcAddress(Th,'Test');
         TIntFunc(Th)(6);
        end;
    end;