Export
 
Declaration specifier to indicate that a procedure in a DLL should be visible from other programs

Syntax

{ Sub | Function } proc_name ( argumentlist ) [ As datatype ] Export

Description

If a function is declared with this clause in a DLL, it is added to the public export table, so external programs can dynamically link to it using DyLibSymbol.

Example

'' mydll.dll

'' in the DLL the function must be declared as export

Function AddNumbers Alias "AddNumbers" _
  ( _
    ByVal operand1 As Integer, ByVal operand2 As Integer _
  ) As Integer Export

   AddNumbers = operand1 + operand2

End Function


'' create a function pointer, arguments must be the same type
'' as in the original function

Dim AddNumbers As Function ( ByVal As Integer, ByVal As Integer ) As Integer
Dim hndl As Any Ptr

hndl=DyLibLoad("mydll.dll")

'' find the proc address (case matters!)
AddNumbers = DyLibSymbol( hndl, "AddNumbers" )

'' then call it ...
Print "1 + 2 = " & AddNumbers( 1, 2 )

Sleep


Dialect Differences

  • Not available in the -lang qb dialect unless referenced with the alias __Export.

Platform Differences

  • Dynamic link libraries are not available in DOS, as the OS doesn't support them.

Differences from QB

  • New to Freebasic

See also