Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.lang.pascal.borland    |    Borland Pascal was actually pretty neat    |    2,978 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 2,742 of 2,978    |
|    Marco van de Voort to Eureka    |
|    Re: Call custom function in pascal    |
|    22 Feb 09 12:19:43    |
   
   679f8a1a   
   From: marcov@stack.nl   
      
   On 2009-02-21, Eureka wrote:   
   > I have a problem. I want call my functions in pascal by their names   
   > stored in an array for example.. (array[1..n] of string).. i want the   
   > same of PHP call_user_func function.. or something near that.. Is   
   > there any way to do this?   
      
   In general: not easily. If all your procedures have the same number and   
   typing of arguments you can make a table (though I wouldn't do that based on   
   strings).   
      
   In FPC/Delphi this works, but apparantly in BP not. Maybe one of the   
   regulars can correct it:   
      
   procedure proc1(i:integer);   
      
   begin   
      
   end;   
      
   procedure proc2(i:integer);   
      
   begin   
      
   end;   
      
   Type   
    TProcType = procedure (i:integer);   
    TProcCombo = record   
    name:string;   
    prc :TProcType;   
    end;   
      
   const nn: array[0..1] of TProcCombo =   
    ((name:'proc1';prc:proc1),(name:'proc2';prc:proc2));   
      
   begin   
   end.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca