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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing variable by reference to COM object

Status
Not open for further replies.

darrellblackhawk

Programmer
Aug 30, 2002
846
US

I've created a COM object in Visual FoxPro for use with PHP.

I've verified it functions properly except for one
important issue: it doesn't change variable contents
passed by reference to methods in the COM object.

I've instanced the object in both C++ and VB to insure it
works as designed, and it does; just not when called from
PHP.

BTW/ I'm running PHP 5.0.4 under Windows with IIS5
as the webserver.

Example(s) of the code:

Sample in php
Code:
<?php
$myvariable = 1;

$oVfp = new COM("php2vfp.php2vfp");

echo $myvariable."<br>";

$oVfp->PassArray(& $myvariable);

echo $myvariable."<br>";
// $myvariable should be 2 at this point, but it's not!
?>

Sample in VB:
Code:
Private Sub Command1_Click()
  Set o = CreateObject("php2vfp.php2vfp")
  Dim i As Integer
  i = 43
  o.PassArray i
  Debug.Print i ' i is 2 at this point!
End Sub

Any pointers would be appreciated.

Darrell
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top