https://bugs.documentfoundation.org/show_bug.cgi?id=161996

--- Comment #1 from Stefano Vanoli <[email protected]> ---
Additional comment:
I've found a workaround.  I call it work around since i have found no clear
documentation about the DLL declaration syntax to be used in Basic LibreOffice.

- When declaring a function or sub linked to a DLL, for any argument intended
to be and array, the type MUST NOT BE SPECIFIED.  When a type is specified in
the prototype, an array identifier passed in the calling instruction triggers a
Basic runtime error.  You might be tempted to use the VBA array convention and
pass just the first element ... but you do not pass an array, you pass a
scalar.  Therefore:

WRONG SYNTAX for the original example:
Declare Function GetDiag Lib "C:\.........\Math.dll" _
  Alias "GetDiag" (ByVal varName As String, _
                         A() As Double, _
                   ByVal len As Long, _
                   ByVal FunctionName As String, _
                         B() As Double, _
                         C() As Double) As Long

CORRECT SYNTAX:
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
A(), B() and C() can also be used .. no impact.
The function must be invoked with: R = GetDiag("f", A, 71, B, C) with A, B and
C  as arrays of the type expected from the DLL.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to