LIB
- 来源: https://www.freebasic.net/wiki/wikka.php?wakka=KeyPgLib
- 最后更新: 2016-02-10
在声明中指定可以找到子程序或函数的库。
语法
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 type描述
在 Sub 或 Function 声明中,以及类方法声明(包括构造函数和析构函数)中,lib 指示包含该函数的库。以这种方式指定的库在链接时就像使用了 #inclib "libname" 或 -l libname 一样。
lib 也可以与 Extern ... End Extern 块 一起使用,为其中的所有声明指定一个 lib。
示例
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
与 QB 的差异
- FreeBASIC 新增功能
参见
Declare#inclib
返回 目录