php调用c dll,PHP调用C++DLL的问题

用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中文网,转载请注明出处,感谢您的尊重!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值