Php calls the C/C ++ codeextern & quot; C & quot; int _ stdcallGameRegister (char * szSystemInfo, char * szRegCode, char * szLicense); PHP code PHPco php calls C ++ dll
Functions to be called in the dynamic library
C/C ++ code
extern "C" int __stdcall GameRegister(char* szSystemInfo, char *szRegCode, char *szLicense);
PHP code
PHP code
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