Lib
Specifies the library where a sub or function can be found as part of a declaration
Declare { Sub | Function } proc_name Lib "libname" [ Alias "symbol_name" ] ( arguments list ) As return_type
Extern "mangling" lib "libname"
Type T
end Type
In Sub or Function declarations, and also in class method declarations (including constructors and destructors), Lib indicates the library containing the function. Libraries specified in this way are linked in as if #Inclib "Libname" or -l libname had been used.
Lib can also be used with Extern ... End Extern Blocks to specifiy a Lib for all declarations inside.
Syntax
Declare { Sub | Function } proc_name Lib "libname" [ Alias "symbol_name" ] ( arguments list ) As return_type
Extern "mangling" lib "libname"
declarative statements
end ExternType T
end Type
Description
In Sub or Function declarations, and also in class method declarations (including constructors and destructors), Lib indicates the library containing the function. Libraries specified in this way are linked in as if #Inclib "Libname" or -l libname had been used.
Lib can also be used with Extern ... End Extern Blocks to specifiy a Lib for all declarations inside.
Example
'' mydll.bas
'' compile with:
'' fbc -dll mydll.bas
Public Function GetValue() As Integer Export
Function = &h1234
End Function
'' compile with:
'' fbc -dll mydll.bas
Public Function GetValue() As Integer Export
Function = &h1234
End Function
Declare Function GetValue Lib "mydll" () As Integer
Print "GetValue = &h"; Hex(GetValue())
' Expected Output :
' GetValue = &h1234
Print "GetValue = &h"; Hex(GetValue())
' Expected Output :
' GetValue = &h1234
Differences from QB
- New to FreeBASIC
See also