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 1,105 of 2,978    |
|    Wolf Behrenhoff to Joe S.    |
|    Re: Function pointers across units    |
|    17 Nov 04 14:23:40    |
   
   From: NoSpamPleaseButThisIsValid2@gmx.net   
      
   Joe S. wrote:   
   > Hello,   
   > I have a unit with a function that provides a generic advanced   
   > keyboard input handler. A syntax checker, a value checker, and a   
   > validation checker need to be plugged in:   
   >   
   > TValidation = function(str:string; var message:string):boolean;   
   >   
   > The idea is that the user can write a procedure for validating a   
   > particular type of input, and pass it to the various input procedures.   
   > Here's an example:   
   >   
   > write('Enter an even integer between 4 and 18: ');   
   > nreadln(n, mycheck);   
   >   
   > nreadln handles integers, and mycheck is of TValidation. The problem   
   > is that if mycheck is in the main program, BP7 reports error 143   
   > (Invalid procedure or function reference) on the nreadln line and   
   > won't compile. Everything is syntactically correct, because it works   
   > if mycheck is moved to a different unit which is used by the input   
   > mechanism unit. It just doesn't work if it is where it needs to be -   
   > in the main program. Any ideas?   
      
   Did you put {$F+} ... {$F-} around your procedure or did you declare it   
   as "far"? If not, then do it.   
      
   Wolf   
      
   --- 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