Contents

# Declare Statement

Proglašava i definira potprogram u DLL fileu iz kojeg želite da pokrenete LibreOffice Basic.

Pogledaj također: FreeLibrary

### Syntax:

    Declare {Sub | Function} Name Lib "Libname" [Alias "Aliasname"] [Argumentlist] [As Type]

### Parameters:

Ime: Drukcije ime od onoga datog u DLL, da pozovete potprogram iz LibreOffice Basic.

Aliasname:ime potprograma je datu u DLL.

Libname: Datoteke ili sustav naziva DLL. Ova biblioteka je automatski učita prvi put da se koristi funkcija.

Argumentlist: List of parameters representing arguments that are passed to the procedure when it is called. The type and number of parameters is dependent on the executed procedure.

Type: Defines the data type of the value that is returned by a function procedure. You can exclude this parameter if a type-declaration character is entered after the name.

da bi proslijedili parametar potprograma kao vrijednost, a ne kao referenca, parametar mora biti označen ključne riječi ByVal .

### Example:

    Declare Sub MyMessageBeep Lib "user32.dll" Alias "MessageBeep" ( Long )
    Sub ExampleDeclare
    Dim lValue As Long
        lValue = 5000
        MyMessageBeep( lValue )
        FreeLibrary("user32.dll" )
    End Sub

## Example 2

      REM When passing arrays by reference, do not specify the type of its elements.
      Declare Function GetDiag Lib "C:\\...\\Math.dll" _
         Alias "GetDiag" ( _
         ByVal varName As String, _
         A, _
         ByVal len As Long, _
         ByVal FunctionName As String, _
         B, _
         C) As Long
    Sub MyCode
      Dim A(100) As Long, B(100) As Long, C(100) As Long ' arrays
      R = GetDiag("f", A, 100, "g", B, C)
      Print R
    End Sub

Please support us!