可以用函数类型来实现
type 
  TMyFunc = function() // 后面要跟参数,和你的function1一致
...var
  MyFunc: TMyFunc;MyFunc := function1;
以后就可以用myfunc来调用function1了

解决方案 »

  1.   

    function AAAA(string)
        if string='myfunc' then
           call Function1()
        end if    if string='myfunb' then
            call function2()
        end ifend function
      

  2.   

    sorry,我的意思是函数的名称是动态的。希望各位大虾能清楚!
      

  3.   

    在DELPHI没有宏代换这个功能.换一下你的思路,你可以定义一个函数,用一个参数来表示你所要进行的功能.例如:FUNCTION  AA(I:STRING)
                            当I为1时进行增加操作;
                            当I为2时进行删除操作;
                            等等.
      
      

  4.   

    以下两种情况可以:
      
      1.是输出的函数:
      按照Windows的方法就行了。
      //  定义函数的地方
      procedure  MyProc(  p:  Integer  );  export;  stdcall;
      begin
          //  do  what  you  want  to  do
      end;
      
      exports
          MyProc;
      
      //  调用的地方
      type
          TMyProc  =  procedure(p:  Integer);
      
      procedure  InvokeMyProc(
              const  sProcName:  String;    //  过程名
                                  param:  Integer    //  参数
                                    );
      var
          aProc:  TMyProc;
      begin
          aProc  :=  GetProcAddress(  hInstance,  PChar(sProcName)  );
          TMyProc(aProc)(  param  );
      end;
      
      //  使用范例
      InvodeMyProc(  'MyProc',  1  );
      
      2.是类对象中的published方法:
      type
          TMyMethod  =  procedure(p:  Integer)  of  object;
      
      procedure  InvokeMyMethod(
                                        Obj:  TObject;  //  对象
              const  MethodName:  String;    //  方法名
                                    param:  Integer    //  参数
                                    );
      var
          aMethod:  TMethod;
      begin
          aMethod.Code  :=  Obj.MethodAddress(  MethodName  );
          aMethod.Data  :=  Obj;
          TMyMethod(aMethod)(  param  );
      end;
      
      //////////////////////////
      其实,还有一种方法:
      if  ProcName='MyProc'  then
          MyProc(  100  );
      
      当然,你不会愿意这么用的,我这样说你还会骂我呢。