Announcement

Collapse

Maintenance

The forum could be offline for 30-60 minutes in the very near future for maintenance (said 3pm Pacific). I was behind on getting this notice. I do apologize.
See more
See less

VB Strings --> PB DLL are killing me!

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • VB Strings --> PB DLL are killing me!

    I've got some problems getting VB to interface with the PB_FTP DLL, and I'm having trouble with figuring out how the following is happening:

    in PB/DLL these two example declares are made:
    FUNCTION ftpChangeDir ALIAS "ftpChangeDir" (BYVAL hSocket AS LONG, sDir AS STRING) EXPORT AS LONG
    FUNCTION ftpPutFile ALIAS "ftpPutFile" (BYVAL hSocket AS LONG, sServer AS STRING, BYVAL hStatus AS LONG, remoteFile AS STRING, localFile AS STRING) EXPORT AS LONG

    and in VB, I declare them as such:
    Private Declare Function ftpChangeDir Lib "Pb_ftp.dll" (ByVal hSocket As Long, ByRef sDir As String) As Long
    Private Declare Function ftpPutFile Lib "Pb_ftp.dll" (ByVal hSocket As Long, ByVal hStatus As Long, ByRef remoteFile As String, ByRef localFile As String) As Long

    Okay, they look very similar as far as the ByRef's go.. But when I call ftpChangeDir, it works fine, and when I call ftpPutFile, it dies on me.. Adding a "MSGBOX localFile" in the start of ftpPutFile shows me that the string is garbled. However, the string in ftpChangeDir is NOT garbled... This seems to be the case regardless of any combination of ByRef / ByVal, or in PB with String / ASCIIZ... What is going on?

    ------------------

  • #2
    Your PB code specifies 5 parameters, but the VB code shows 4 for the same function declaration...

    You are missing "Byref sServer AS STRING" from the VB code, or remove the parameter from the PB code.

    PB:
    FUNCTION ftpPutFile ALIAS "ftpPutFile" (BYVAL hSocket AS LONG, sServer AS STRING, BYVAL hStatus AS LONG, remoteFile AS STRING, localFile AS STRING) EXPORT AS LONG
    VB:
    Private Declare Function ftpPutFile Lib "Pb_ftp.dll" (ByVal hSocket As Long, ByVal hStatus As Long, ByRef remoteFile As String, ByRef localFile As String) As Long




    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>
    Lance
    mailto:[email protected]

    Comment


    • #3
      Argh, Thanks Lance!

      A good reason for NOT doing PB/DLL programming at 3:30AM.

      ------------------

      Comment

      Working...
      X