Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Force 4.0 Reference - pascal pascal calling convention modifier http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 pascal              Pascal calling convention modifier
------------------------------------------------------------------------------
 Syntax
   func|proc [<type>] <symbol> pascal <scope>

 Arguments
   <type> is the return type of the function.
   <symbol> is the symbol name of the function.
   <scope> is the range of visibility for the function.

 Description
   The pascal function type modifier declares a function or procedure
   as type Pascal. Functions declared as pascal employ the Pascal calling
   convention. Force by default generates function calls that conform with
   the C calling convention. Most Windows API functions and all functions
   callable from Clipper code employ the Pascal convention.

   Differences between the C and Pascal calling conventions:

   ----------------------------------------------------------------------
   Feature                               C               Pascal
   ----------------------------------------------------------------------
   Leading underscore in symbol names    yes             no
   All-uppercase symbol names            no              yes
   Parameter passing sequence            right to left   left to right
   Stack cleaned up by                   caller          called
   ----------------------------------------------------------------------

 Example
   #define EXAMPLE_KEYWORD
   #include example.hdr

   // declarations for functions in clipper.lib
   
   func ptr( char ) _parc extern
   param value int iParamNum, value int iArrayIndex
   
   proc _retc extern
   param value ptr( char ) pString
   
   func uint _gtWriteCon extern
   param value ptr( char ) pString, value uint uLength
   
   
   // this function can be called from a Clipper application
   
   proc ClpTest pascal
   vardef
      ptr( char ) pIn
   enddef
   pIn := _parc( 1, 1 )            // get string parameter from Clipper code
   _gtWriteCon( pIn, len( *pIn ) ) // display string
   _retc( &"Force" )               // pass a string to Clipper code
   endproc
   
   
   /*
   Clipper code to use as the main module linked with the above example.
   
   proc main
   ? ClpTest( "Clipper" )
   return
   */
   
   proc Test static pascal
   param const char cMsg
   ? cMsg
   endproc
   
   proc Test_pascal
   Test( "Pascal function" )
   endproc

   proc main
   Test_pascal()
   endproc

See Also: func proc

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson