Lib
 
指定可以在声明中找到子或函数的库

语法

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


说明

SubFunction声明中,以及类方法声明(包括构造函数和析构函数)中,Lib表示包含该函数的库。以这种方式指定的库被链接,就好像#Inclib "Libname"-l libname已被使用。

Lib也可以与Extern...Block一起使用,以指定其中所有声明的Lib.

例子

''mydll.bas
''编译:
''FBC -etc mydll.bas

Public Function GetValue() As Integer Export
  Function = &h1234
End Function


Declare Function GetValue Lib "MYDLL" () As Integer

Print "GetValue = &h"; Hex(GetValue())

'预期产量:
'GetValue = &h1234


与QB差别

  • 新的FreeBASIC

参考