I have a question about using ByRef in Declares and Function calls.

Say I need to call an OS function using a Declare, and that function needs a
pointer to a 4 byte integer in order to return some value.  I would call
this function like this:

Dim i As Integer
Declare Sub SomeFunc Lib "somelib" (ByRef Data As Integer)
SomeFunc(i)

The returned value is now in 'i'.

But what happens when this code is in a subroutine that I need to call, and
pass in the integer pointer?  Now that code looks ike this:

Sub MyFunc (ByRef i As Integer)
Declare Sub SomeFunc Lib "somelib" (ByRef Data As Integer)
SomeFunc(i)
End Sub

and I call this using

Dim x As Integer
MyFunc(x)

Now I'm using ByRef twice.  So when I call SomeFunc am I going to pass a
pointer to a pointer to 'x'?
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to