首頁 > php教程 > php手册 > PHP调用C++DLL的问题

PHP调用C++DLL的问题

WBOY
發布: 2016-06-06 19:42:29
原創
1642 人瀏覽過

用DynamicWrapper方法调用。下载DynamicWrapper.dll到php ext下与windows system32下, $dw = new COM("DynamicWrapper"); $dw-Register("EbUsbApi.dll", "EbCreateDataFile", 'i=sls', "f=s", "r=l"); $ch = $dw-EbCreateDataFile("222",11,"22"); i=descri

用DynamicWrapper方法调用。下载DynamicWrapper.dll到php ext下与windows system32下, 
$dw = new COM("DynamicWrapper"); 
$dw->Register("EbUsbApi.dll", "EbCreateDataFile", 'i=sls', "f=s", "r=l"); 
$ch = $dw->EbCreateDataFile("222",11,"22"); 

i=describes the number and data type of the functions parameters

f=type of call _stdcall or _cdecl. So it can work with both MS C++ and Borland C++. Default to _stdcall. If that doesn't work use _cdecl. If that doesn't work good luck!

r=return data type.

Data types are:

const ARGTYPEINFO ArgInfo[] = 
{
{'a', sizeof(IDispatch*), VT_DISPATCH}, // a IDispatch*
{'c', sizeof(unsigned char), VT_I4}, // c signed char 
{'d', sizeof(double), VT_R8}, // d 8 byte real 
{'f', sizeof(float), VT_R4}, // f 4 byte real 
{'k', sizeof(IUnknown*), VT_UNKNOWN}, // k IUnknown* 
{'h', sizeof(long), VT_I4}, // h HANDLE 
{'l', sizeof(long), VT_I4}, // l long 
{'p', sizeof(void*), VT_PTR}, // p pointer 
{'s', sizeof(BSTR), VT_LPSTR}, // s string 
{'t', sizeof(short), VT_I2}, // t short 
{'u', sizeof(UINT), VT_UINT}, // u unsigned int 
{'w', sizeof(BSTR), VT_LPWSTR}, // w wide string 
}
[b]
请教返回值为布尔类型应该选哪个?[/b]

相關標籤:
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門推薦
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板