Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

call staement using byref keyword in call

Status
Not open for further replies.

TammyKing

Programmer
Oct 21, 2002
5
0
0
US
Hi All,

I am trying to call a FoxPro 7 dll, which our group developed. When we call it I can see that the data gets into the dll properly and it is properly processed, but the results are not returned. It seems like the data is being passed by value not by reference. The call statement doc from MS says you can put byref on the call statement, but no format is listed. Has anyone ever used byref on a call statement. Or does anyone know how the FoxPro function needs to be defined. We did explicit typing in FoxPro, I believe this is new in Version 7.

Thanks, Tammy
 
Hi,

I tried many times to make ByRef work in the Call statement none of them will compile. Do you have a code snippet that compiles?

Thanks
 
Hi Tammy,

Can I see the line of code that makes the call you mention?
 
Hi Ron,

Here is a snippet illustrating what we are trying to do:

Private Sub Form_Load()
Call MySub (ByRef sZ )
End Sub

Private Sub MySub(test As String)
test = test & "1"
End Sub

In the real code we are calling a vfp7 dll, I received some info from another forum that may help us. We are going to create properties in the vfp dll for the values we want to return. The syntax for the call was something we wanted to try. I am not sure if that would help in this instance.

Thanks, Tammy
 
Scrap my code - it's naff...

I suggest calling the function as normal, which should call by reference (I think!)

Then again, surely the called procedure should have to know what it's expecting if we are going to pass by reference. Bear in mind that if the called procedure is pass by value, it is geared up to destroy the parameters at the end of the function...

For this reason, I suspect that if you want to choose how to pass parameters, the calling function will probably have to be defined to accepted parameters as references...

Hope that's not upset you too much!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top