Difference between revisions of "ALIAS"

From QB64 Wiki
Jump to navigation Jump to search
imported>Clippy
m
imported>Clippy
m
Line 1: Line 1:
The '''ALIAS''' clause in a [[DECLARE LIBRARY]] statement block tells the program that you will use a different name than that used in the program. This only applies when declaring non-BASIC procedures.
The '''ALIAS''' clause in a [[DECLARE LIBRARY]] statement block tells the program the name of the procedure used in the external library.




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




{{Parameters}}
{{Parameters}}
* The ''actual name'' is the same procedure name as it is inside of the DLL library.
* The ''pseudo name'' is the name of the [[SUB]] or [[FUNCTION]] the QB64 program will use.
* The name does not have to be inside of quotes when using [[DECLARE LIBRARY]].
* 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 procedure name does not have to be inside of quotes when using [[DECLARE LIBRARY]].
* QB64 does not support optional parameters at this time.
* In Qbasic ALIAS was originally only used in a [[DECLARE (non-BASIC statement)]] library statement declaration.
* In Qbasic ALIAS was originally only used in a [[DECLARE (non-BASIC statement)]] library statement declaration.



Revision as of 06:59, 5 December 2015

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 procedure name does not have to be inside of quotes when using DECLARE LIBRARY.
  • QB64 does not support optional parameters at this time.
  • In Qbasic ALIAS was originally only used in a DECLARE (non-BASIC statement) library statement declaration.


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

DECLARE LIBRARY SUB MouseMove ALIAS SDL_WarpMouse (BYVAL xoffset&, BYVAL yoffset&) END DECLARE

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