LIB
- Source: https://www.freebasic.net/wiki/wikka.php?wakka=KeyPgLib
- Last revised: 2016-02-10
Specifies the library where a sub or function can be found as part of a declaration
Syntax
vb
declare { sub | function } proc_name lib "libname" [ alias "symbol_name" ] ( arguments list ) as return_type
extern "mangling" lib "libname"
declarative statements
end extern
type T
as integer dummy
declare constructor lib "libname" [ alias "symbol_name" ] ( arguments list )
end typeDescription
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.
Examples
start GeSHi
vb
'' mydll.bas
'' compile with:
'' fbc -dll mydll.bas
Public Function GetValue() As Integer Export
Function = &h1234
End Functionend GeSHi
start GeSHi
vb
Declare Function GetValue Lib "mydll" () As Integer
Print "GetValue = &h"; Hex(GetValue())
' Expected Output :
' GetValue = &h1234end GeSHi
Differences from QB
- New to FreeBASIC
See also
Declare#inclib
Back to DocToc