Difference between revisions of "ALIAS"

From QB64 Wiki
Jump to navigation Jump to search
imported>Clippy
m
m (Text replacement - "{{Parameters}}" to "{{PageParameters}}")
 
(20 intermediate revisions by 4 users not shown)
Line 1: Line 1:
The '''ALIAS''' clause in the {{KW|DECLARE (non-BASIC statement)|DECLARE}} statement tells the program that you will use a different name than that in the library. This only applies when declaring non-BASIC procedures.
#REDIRECT [[DECLARE LIBRARY]]
 
The [[ALIAS]] clause in a [[DECLARE LIBRARY]] statement block tells the program the name of the procedure used in the external library.




{{PageSyntax}}
{{PageSyntax}}
:ALIAS "aliasname"
: SUB ''pseudoname'' [[ALIAS]] ''actualname'' [(''parameters'')]


{{PageParameters}}
* The ''pseudo name'' is the name of the [[SUB]] or [[FUNCTION]] the QB64 program will use.
* The ''actual name'' is the same procedure name as it is inside of the DLL library.
* QB64 must use all parameters of imported procedures including optional ones.




{{PageDescription}}
{{PageDescription}}
* The aliasname is the same procedure name as it is inside of the library.
* The ALIAS name clause is optional as the original library procedure name can be used.
* The procedure name does not have to be inside of quotes when using [[DECLARE LIBRARY]].
* QB64 does not support optional parameters.


[[Keywords currently not supported by QB64|QB64 supports ALIAS in DECLARE LIBRARY procedures only!]]


{{PageExamples}}
''Example:'' Instead of creating a SUB with the Library statement inside of it, just rename it:
{{CodeStart}} '' ''
{{Cl|DECLARE LIBRARY}}
    {{Cl|SUB}} MouseMove {{Cl|ALIAS}} glutWarpPointer ({{Cl|BYVAL}} xoffset&, {{Cl|BYVAL}} yoffset&)
{{Cl|DECLARE LIBRARY|END DECLARE}}


{{Cl|DO}} {{Cl|UNTIL}} {{Cl|_SCREENEXISTS}}: {{Cl|LOOP}}
{{Cl|PRINT}} "Hit a key..."
{{Cl|SLEEP}}
MouseMove 1, 1
{{CodeEnd}}
:''Explanation:'' When a Library procedure is used to represent another procedure name use ALIAS instead. Saves creating a SUB! Just place your name for the procedure first with the actual Library name after ALIAS.




{{PageSeeAlso}}
{{PageSeeAlso}}
* [[DECLARE (non-BASIC statement)]]
* [[SUB]], [[FUNCTION]]
* [[DECLARE LIBRARY]], [[BYVAL]]
* [[DECLARE LIBRARY]], [[BYVAL]]
 
* [[DECLARE DYNAMIC LIBRARY]]
 




{{PageNavigation}}
{{PageNavigation}}

Latest revision as of 12:45, 17 February 2021

Redirect to:

The ALIAS clause in a DECLARE LIBRARY statement block tells the program the name of the procedure used in the external library.


Syntax

SUB pseudoname ALIAS actualname [(parameters)]


Parameters

  • The pseudo name is the name of the SUB or FUNCTION the QB64 program will use.
  • The actual name is the same procedure name as it is inside of the DLL library.
  • QB64 must use all parameters of imported procedures including optional ones.


Description

  • The ALIAS name clause is optional as the original library procedure name can be used.
  • The procedure name does not have to be inside of quotes when using DECLARE LIBRARY.
  • QB64 does not support optional parameters.


Examples

Example: Instead of creating a SUB with the Library statement inside of it, just rename it:

DECLARE LIBRARY SUB MouseMove ALIAS glutWarpPointer (BYVAL xoffset&, BYVAL yoffset&) END DECLARE DO UNTIL _SCREENEXISTS: LOOP PRINT "Hit a key..." SLEEP MouseMove 1, 1

Explanation: When a Library procedure is used to represent another procedure name use ALIAS instead. Saves creating a SUB! Just place your name for the procedure first with the actual Library name after ALIAS.


See also



Navigation:
Keyword Reference - Alphabetical
Keyword Reference - By Usage
Main Wiki Page