Simple problem I thought. I have a dll that will do address correction for me. But it requires that strings of chars get passed. When I run the following code it just gives me what I passed it not the address correction. I know the dll is running because is requires the data files on a CD, and if I take the CD out the program fails. Any ideas of how to pass the pointers since I can find little to no documention on FFI.
Code
$zp4s = 11111.0;
$win32_ffi = <<<EOD
[lib='zp4.dll'] void ZP4StartSession (long *s1);
[lib='zp4.dll'] long ZP4InputOrder (long s2, char *s6);
[lib='zp4.dll'] long ZP4OutputOrder (long s3, char *s7);
[lib='zp4.dll'] long ZP4Correct (long s4, char *s8, char *s9);
[lib='zp4.dll'] void ZP4StopSession (long s5);
EOD;
$zp4 = new ffi($win32_ffi);
$zp4->ZP4StartSession(&$zp4s);
echo $zp4s."<BR>";
$list1 = "Address\tCity\tState\tZip";
$list2 = "Address (final)\tCity (final)\tState (final)\tZip (final)\tError message";
$t1 = $zp4->ZP4InputOrder($zp4s,&$list1);
echo $t1."<BR>";
$t1 = $zp4->ZP4OutputOrder($zp4s,&$list2);
echo $t1."<BR>";
$input1 = "2828 Trinity Mills\tDallas\tTX\t75006";
$output1 = $input1." no change ";
$t5 = $zp4->ZP4Correct($zp4s,&$input1,&$output1);
echo $t5."<BR>";
echo "<BR>";
echo $input1;
echo "<BR>";
echo $output1;
$t3=$zp4->ZP4StopSession($zp4s);The problem may be with ffi. A visit to its home page (<!-- m --><a class="postlink" href="http://zlog.thebrainroom.net/">http://zlog.thebrainroom.net/</a><!-- m -->) doesn't inspire a lot of confidence (and it's only in alpha, besides).
Code
$zp4s = 11111.0;
$win32_ffi = <<<EOD
[lib='zp4.dll'] void ZP4StartSession (long *s1);
[lib='zp4.dll'] long ZP4InputOrder (long s2, char *s6);
[lib='zp4.dll'] long ZP4OutputOrder (long s3, char *s7);
[lib='zp4.dll'] long ZP4Correct (long s4, char *s8, char *s9);
[lib='zp4.dll'] void ZP4StopSession (long s5);
EOD;
$zp4 = new ffi($win32_ffi);
$zp4->ZP4StartSession(&$zp4s);
echo $zp4s."<BR>";
$list1 = "Address\tCity\tState\tZip";
$list2 = "Address (final)\tCity (final)\tState (final)\tZip (final)\tError message";
$t1 = $zp4->ZP4InputOrder($zp4s,&$list1);
echo $t1."<BR>";
$t1 = $zp4->ZP4OutputOrder($zp4s,&$list2);
echo $t1."<BR>";
$input1 = "2828 Trinity Mills\tDallas\tTX\t75006";
$output1 = $input1." no change ";
$t5 = $zp4->ZP4Correct($zp4s,&$input1,&$output1);
echo $t5."<BR>";
echo "<BR>";
echo $input1;
echo "<BR>";
echo $output1;
$t3=$zp4->ZP4StopSession($zp4s);The problem may be with ffi. A visit to its home page (<!-- m --><a class="postlink" href="http://zlog.thebrainroom.net/">http://zlog.thebrainroom.net/</a><!-- m -->) doesn't inspire a lot of confidence (and it's only in alpha, besides).