Hey,

If you like to use the oop features of PowerBasic and like to put them into a DLL where you'd have function to instantiate a instance of a class you've definitely run into this issue. You need to generate a stub file that contains the declaration of the interface. Having to copy and paste this is a tedious task so this little tool just generates the stub file of the class/interface file for you.

Cheers

Code:
' ======================================================================================================
' Stub Generator
' ======================================================================================================
#compile Exe "stubgen.exe"
#dim all
#Debug Error On
' ======================================================================================================
Function pbmain() As Long

    Local FileName   As String
    Local OutputFile As String
    Local hFile      As Long
    Local inBuffer   As String
    Local hOut       As Long

    FileName = Command$

    If IsFalse(Len(FileName)) Then
       StdOut "Filename required containing the class/interface."
       Exit Function
    End If

    If Instr(FileName, ".") Then
       OutputFile = Extract$(FileName, ".") & ".stb"
    Else
       OutputFile = FileName & ".stb"
    End If

    hFile = FreeFile

    ' input
    Open FileName for input As #hFile

    ' output
    hOut  = FreeFile

    Open OutputFile for Output As #hOut

    Print #hOut, "' ========================================================================"
    Print #hOut, "' Interface Stub File for " & FileName
    Print #hOut, "' Created on " & Date$ & " at " & Time$
    Print #hOut, "' ========================================================================"

    While Not Eof(hFile)
       inBuffer = ReadLine(hFile)

       Select Case ValidateWord(inBuffer)
       Case 1 ' Write the buffer
          StdOut InBuffer
          Print #hOut, InBuffer
       Case 2 ' Documentation purposes
          Print #hOut, "' == " & InBuffer & " == "
       End Select
    Wend
    Close #hFile
    Close #hOut

End Function


Function ReadLine(ByVal hFile As Long) As String
 Local Buffer As String
 If not Eof(hFile) Then
    Line Input #1, Buffer
 End If
 Function = Buffer
End Function

Function ValidateWord(ByVal InBuffer As String) As Long

  Local ParseItems As Long
  Local Temp       As String

  Temp = Trim$(Ucase$(InBuffer))

  ParseItems = ParseCount(Temp, " ")

  If ParseItems Then

     Select Case Parse$(Temp, " ", 1)
     Case "CLASS"
          If Parse$(Temp, " ", 2) <> "METHOD" Then
             Function = 2
          End If
     Case "INTERFACE", "INHERIT"
          Function = 1
     Case "METHOD"
          If Parse$(Temp, " ", 2) <> "=" Then
             Function = 1
          End If
     Case "PROPERTY"
          If Parse$(Temp, " ", 2) <> "=" Then
             Function = 1
          End If
     Case "END"
          If Parse$(Temp, " ", 2) = "INTERFACE" Then
             Function = 1
          End If

     End Select

  End If

End Function