Repository navigation
Alias Name
Home › Procedures › Alias (Name)
Clause of the Sub and Function statements that provides an alternate internal name.
[Declare] { Sub | Function } usablename Alias "alternatename" (...)Alias gives an alternate name to a procedure. This alternate name cannot be used within the program to call the procedure, but it is visible (if the function is not private) to the linker when linking with code written in other languages.
Alias is commonly used for procedures in libraries written in other languages when such procedure names are valid in the other language but invalid in BASIC. When using Alias with Declare, only the alternate name is used by the linker.
Differently from normal procedure names, Alias does not change the case of the alternate name, so it is useful when external code requires an exported function with a particular name or with a particular case.
Alias can be used to specify an alternate name for Type definitions.
Alias can be used as a modifier that specifies an alternate name mangling for procedure parameters. See Alias (Modifier)
declare sub usablename Alias "alternatename" ( ... )ordeclare function usablename Alias "alternatename" ( ... )or
sub usablename Alias "alternatename" ( ... )
...
end subor
function usablename Alias "alternatename" ( ... )
...
end functionor
type typename Alias "alternatename" ( ... )
...
end type- In QB,
Aliasonly worked withDeclare.
If there is a sub (without parameter) called xClearScreen in an external library and you want to reference it with the name ClearVideoScreen, here is sample code to do so:
Declare Sub ClearVideoScreen Alias "xClearScreen" ()
If there is a function (with parameters and return value) called MyFunctioninLib in an external library and you want to reference it with the name myfunction, here is sample code to do so:
Declare Function myfunction Alias "MyFunctioninLib" (ByVal As Long, ByVal As Long, ByVal As ZString Ptr) As Integer
A procedure meant to be used by external C code, exported as MyExportedProc:
Function MultiplyByFive cdecl Alias "MyExportedProc" (ByVal Parameter As Integer) As Integer Export
Return Parameter * 5
End FunctionCategory: Procedures
Kind: keyword
Reproduced from the FreeBASIC Wiki Manual under the GNU Free Documentation License 1.3 — with no Invariant Sections, no Front-Cover Texts and no Back-Cover Texts. Copyright © the FreeBASIC project and wiki contributors. See License.
tiko-lang · Home · Feature Index · Keyword Index · License
FreeBASIC manual pages reproduced under the GNU FDL 1.3.
- Generics
- Interfaces
- For Each
- Iterators
- Tuples
- Array Results
- Defer
- Lambdas
- Block Strings
- Partial Types
- String Slices
- Embed
- Typed Variadics
- C Header Import
- Foreign Library Linking
- UString
- Fixed-Width Types
- Nullptr
- String Library
- Format
- Array
- Map
- Set
- LinkedList
- OrderedMap
- OrderedSet
- Sorting
- Optional
- Result
- Smart Pointers
- Date and Time (Chrono)
- Filesystem
- File Streams
- Config (INI and TOML)
- Codec
- Hash
- UUID
- OS
- Process
- Net
- HTTP and TLS
- Math Library
- Finance
- Logging
- Terminal TUI Library
- PsControls
- tkControls
- sys/win
- Goroutines and Channels
- LLVM Backend
- tiko build
- TIKO_COMPILER
- Variable Declarations
- Standard Data Types
- User Defined Types
- Procedures
- Operators
- Control Flow Statements
- Converting Data Types
- Array Functions
- String Functions
- Mathematical Functions
- Bit Manipulation
- Date and Time Functions
- File I/O Functions
- Console Functions
- User Input (Runtime Library)
- User Input Functions (Graphics Library)
- Screen Functions
- 2D Drawing Functions
- Graphics Library Reference
- Graphics Keyword List
- Memory Functions
- Threading Support Functions
- Error Handling Functions
- Operating System Functions
- Preprocessor
- Intrinsic Defines
- Miscellaneous Keywords
- Modularizing