Lib
 
Specifies the DLL where a sub or function can be found as part of a declaration

Syntax

Declare { Sub | Function } proc_name Lib "dllname" Alias "symbol_name" ( arguments list ) As return_type

Description

In Sub and Function declarations, Lib indicates the dll containing the function. Libraries specified in this way are linked as if the library had been specified with #inclib.

When specifying dllname, do not include the extension of the file name. For example, if the declaration is meant to reference the file mydll.dll or mydll.so, use Lib "mydll".

Example

'' mydll.bas
'' 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


Differences from QB

  • New to FreeBASIC

See also