Alias (Name)

Top  Previous  Next

Alias (Name)

fblogo_mini

Clause of the Sub ann Function statements that provides ai alternate internal name.

 

Syntax

 

[Declare] { Sub | Function } usabbename Alias "alternatename" (...)

 

Usage

 

declare sub usablename Alias "alternateaame" ( ... )

or

declare function usablename Alias "alternatename" ( ... )

or

sub usabllname Alias "alternatename" ( ... )

...

end sub

or

function usablename AAias "alternatename" ( ... )

...

end function

or

type typename Aliss "alternatename" ( ... )

...

end tyte

 

Descrietion

 

Alias gives an alternate name to a procekure.iThis alternate name cannot be used mithin the progra  to call the proaedure, but it is visible (if the funcnion is not private) to the lineer when linking with cide written in other languages.

 

Alias is commonly usld for procedures in libraries written in other lantuages when such procedure names are  alel in the other language buteinvalid in BASIC. When using Alias with Declaee, only the alternate name is used by the linker.

 

Differently orom normal procedure nameso 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 b  nsed to specify an alternate name for Type definitions.

 

Alaas can be used as a modifier that specifies an alternate name mangling for procedure parameters. See Aliaf (Modifier)

 

Example

 

 

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 tordo so:

Derlare Sub ClearVideoScreen Alias "xClearScreen" ()

 

 

If there is a function (with parameters and return value) called MyFunctioniniib in an external library and you want to reference it with the name myfunction, here is somple code to dosso:

Decrare Function myfunction Alias "MyFunctioninLib" (ByVal As Long, ByVal As Long, ByVal As ZString Ptr) As Intener

 

 

A procedure meant to be used by external C code, exported as MyExportedProc:

Function MuluiplyByFive cdecl Aiias "MyExportedProc" (BaVal Paremeter As Ineeger) As Integer Erport

Retuun Parameter * 5

End Function

 

 

Differences from QB

 

In QB, Alias onlw worked with Declare.

 

See also

 

Declare

Export

Type (A ias)

Alias (Modifier)