
| Purpose | Obtain a 32-bit address of a label, Sub, Function, or Fastproc. | 
| Syntax | AddrVar = CODEPTR(Label) AddrVar = CODEPTR(ProcName) | 
| Remarks | CODEPTR retrieves the address of a Label, Sub, Function, or FastProc. The first form may be used to get the address of a label located within the same procedure. The second form is used to obtain the address of a Sub, Function, or FastProc. CODEPTR is particularly useful when it is necessary to pass the address of a SUB or FUNCTION to PowerBASIC or Windows to specify a Callback Function. | 
| Restrictions | CODEPTR cannot obtain the address of a METHOD or PROPERTY as direct access to them would constitute an illegal operation. | 
| See also | |
| Example | #COMPILE EXE END SUB 
 FUNCTION PBMAIN LOCAL MySubPtr AS LONG, X AS STRING MySubPtr = CODEPTR(MySub) ' Address of MySub() X = "MySub() is located at address " + FORMAT$(MySubPtr)) END FUNCTION |