Php calls the function extern & nbsp; C & nbsp; int & nbsp ;__ stdcall & nbsp; GameRegister (char * & nbsp; szSystemInfo, & nbsp; char & nbsp; * szRegCode, & nbsp; char & nbsp; * szLicense); PHP code & lt ;? Php & nbs php calls C ++ dll
Functions to be called in the dynamic library
extern "C" int __stdcall GameRegister(char* szSystemInfo, char *szRegCode, char *szLicense);
PHP code
$dw = new Com("DynamicWrapper");
$dw->Register("EducationGameRegister.dll", "GameRegister", 'i=sss', "f=s", "r=u");
$reg_code = "";
$ch = $dw->GameRegister("P2G9YFWGZW68G","2597367cea95b2cf0aace3bd5059c33e",&$reg_code);
echo "Return Value:".$ch;
echo "Register Code:".$reg_code;
?>
The following error occurs during running:
Fatal error: Uncaught exception 'com _ exception' with message 'error [0x80070057] parameter is incorrect. 'In D: \ WAMP \ WWW \ index. php: 11 Stack trace: #0 D: \ WAMP \ WWW \ index. php (11): com-> Register ('educationgamere... ', 'gameregister', 'I = SS', 'F = S', 'R = l') #1 {main} thrown in D: \ WAMP \ WWW \ index. php on line 11
Let me take a look at PHP for the first time. thank you!
------ Solution --------------------
The prototype requires that the parameter be a pointer, while com cannot pass the pointer.
------ Solution --------------------
$ Ch = $ dw-> GameRegister ("P2G9YFWGZW68G", "2597367cea95b2cf0aace3bd5059c33e", $ reg_code );
In this case