I've defined a sub BigInt_FactPrime(a As String, ByRef pf() As String) where a is the number that is to be factorised and pf() is the array which will contain the prime factors. I've got the function working but I have to dimension the array beforehand for it to work, even though I do a ReDim (see code).
SUB BigInt_FactPrime()
  LOCAL a,b,c,q,r AS STRING
  LOCAL i,n AS DWORD
  DIM pf() AS LOCAL STRING
  DIM p(7) AS LOCAL INTEGER
 
  ' Variables for thinBasic_ParseVariableInfo.
  LOCAL sVpt,sMtp,sStp,sFix,sElm,sEsz,sDpt,sPos AS LONG
  ' Parse parameters.
  IF thinBasic_CheckOpenParens THEN
    thinBasic_ParseString a
    IF thinBasic_CheckComma THEN
      thinBasic_ParseVariableInfo(sVpt,sMtp,sStp,sFix,sElm,sEsz,sDpt,sPos)
      IF NOT thinBasic_ErrorFlag THEN
        IF thinBasic_CheckCloseParens THEN
          ' Variabele moet een dynamische string zijn.
          IF sMtp<>%MainType_IsString OR sFix THEN RTError("Return variable for factors must be a dynamic string array") : EXIT SUB
 
          ' processing code deleted
          ' pf() is properly REDIMed here as pf(1 TO n)
 
          ' Transfer internal array to thinBasic.
          thinBasic_VariableRedim(sVpt, %TRUE, n, 0, 0)
          FOR i=1 TO n
            thinBasic_ChangeVariableStringDirect(sVpt, i, pf(i))
          NEXT i
 
        END IF
      END IF
    END IF
  END IF
END SUB
The little test script I have is the following.
Uses "Console"
Module "BigInt"
Alias String As BigInt
BigInt a,b,n,p
DWord i,j
Quad t
Boolean c
PrintL "FactPrime..."
Dim pf(1) As BigInt
a=BigInt_Dec(BigInt_Pow(2,64))
Print BigInt_ToString(a)+" = "
BigInt_SetForcePlus(FALSE)
HiResTimer_Get
BigInt_FactPrime(a,pf())
t=HiResTimer_Delta
j=UBound(pf)
Print BigInt_ToString(pf(1))+$SPC
If j>1 Then
For i=2 To j
Print "* "+BigInt_ToString(pf(i))+$SPC
Next i
EndIf
BigInt_SetForcePlus(TRUE)
PrintL " ("+TStr$(t/1000000)+")"
PrintL
WaitKey
If I do the DIM of pf as pf() (line 9) I get a runtime error in thinBasic_ParseVariableInfo. Should I use another function from the SDK than thinBasic_ParseVariableInfo? Should I do something else so that I can supply an undimensioned array? I know it's possible because ListDir does it.

Any help is greatly appreciated.