VB to/from FB is this ok?

External libraries (GTK, GSL, SDL, Allegro, OpenGL, etc) questions.
Post Reply
Muddy
Posts: 1
Joined: Sep 01, 2021 19:02

VB to/from FB is this ok?

Post by Muddy »

Hello again! I'm back. Really have enjoyed using FB for efficiency purposes!
FB 0.24 Side:

Code: Select all

#lang "fblite"
extern "windows-ms"
Type PParam
aa as ubyte
bb as zstring * 6 '(5 + 0x00)
cc as ubyte
dd as ubyte
End Type
Function Test alias "Test" (byref zz as PParam) as short export
zz.aa=1
zz.bb="hello"
zz.cc=3
zz.dd=4
Test=9
End function
End Extern
VB6 Side:

Code: Select all

Private Type PParam
aa as byte
bb as string * 6
cc as byte
dd as byte
End Type
Private Param as PParam
Private Declare Function Test Lib "FBSide.dll" (ByRef zz as PParam) As Integer
Private Sub Form_Load()
Dim Q as Integer
Me.Show
Me.Refresh
DoEvents
Q=Test(Param)
Debug.print Q
 Debug.print Param.aa
Debug.print Param.bb
Debug.print Param.cc
Debug.print Param.dd
Stop
End
End Sub
VB Debug window reads:

Code: Select all

1
hello
3
4
Summary:
Assuming fixed length Type mostly bytes, singles, etc...
This all seems to work. Have I made any glaring errors I should be aware of?

In short, is the ByRef in fb copying the data from vb6, or REFerencing it as a pointer as desired? Or is it necessary to copy the data (transparently to me)?

V1ctor had written about pointer to a pointer in VB references... Anyone? Am I a-ok?
Thanks in advance!
Joe
Post Reply