1
1
Fork 0
mirror of https://github.com/QB64-Phoenix-Edition/QB64pe.git synced 2024-07-01 13:50:36 +00:00
QB64-PE/internal/help/ALIAS.txt
2017-10-10 11:55:21 -03:00

49 lines
1.7 KiB
Plaintext

#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}}
: 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.
{{PageDescription}}
* 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.
==QBasic/QuickBASIC==
* In Qbasic ALIAS was originally only used in a [[DECLARE (non-BASIC statement)]] library declarations.
{{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}}
* [[SUB]], [[FUNCTION]]
* [[DECLARE LIBRARY]], [[BYVAL]]
* [[DECLARE DYNAMIC LIBRARY]]
* [[DECLARE (non-BASIC statement)]]
{{PageNavigation}}