+ -
当前位置:首页 → 问答吧 → 探究php在windows下是否支持多线程

探究php在windows下是否支持多线程

时间:2009-04-18

来源:互联网

本帖最后由 chnzbq 于 2009-4-18 19:01 编辑

今天看了一篇文章"windows下开发PHP扩展(无需Cygwin)"

突然有一种冲动,想开发一个php支持多线程的dll扩展.

跟着去百度,google一下,C/C++是不支持多线程.但是在windows下,可用window.h里面创建线程...

于是,本人大喜...觉得,微软的操作系统支持多线程真是好.

然后,我找了一个Win API的多线程例子,准备大展身手.
多线程的例子如下:
#include <stdio.h>
#include <windows.h>
DWORD WINAPI funA(LPVOID lp)
{
int i=1;
int sum=0;
for(i=1;i<=100;i++)
//sum=sum+i;
printf("a[0] thread print:%d\n",sum);
return 0;
}
DWORD WINAPI funB(LPVOID lp)
{
int i=1;
int sum=1;
for(i=1;i<=101;i++)
//sum=sum+i;
printf("a[1] thread print:%d\n",sum);
return 0;
}

void main()
{
HANDLE a[2];
DWORD dwT,dwY;

a[0]=CreateThread(NULL,0,funA,0,0,&dwT);
a[1]=CreateThread(NULL,0,funB,0,0,&dwY);
WaitForMultipleObjects(2,a,TRUE,50000);
CloseHandle(a);
}

执行结果如下:
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[0] thread print:0
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
a[1] thread print:1
Press any key to continue

然后,按照文章开头的那篇文章的方法,进行了php扩展的开发...
(贴一下那篇文章)
windows下开发php扩展网上很多资料都说需要Cygwin,其实完全可以不必安装该东东。没错,是可以在linux下生成骨架后拷到windos下来用,但是,如果没有linux环境呢?什么,装虚拟机?我晕,你咋又绕回去了- -! 除了编译外,shell环境主要就是为了生成扩展的骨架,其实骨架已经在php源码包中了了,我们只需要把相关名字替换一下即可使用。

准备:
1、php源码包和windows下的二进制包,以及安装Visual C++,并把Microsoft Visual Studio\Common\MSDev98\Bin的绝对路径添加到windows环境变量
2、解压源码包到d:\php_src
3、进入d:\php_src\ext目录,复制skeleton文件夹,并重命名为要开发扩展的名字,本例为“linvo”
4、把二进制包中dev目录下的php5ts.lib文件,拷入新建的linvo目录
5、编辑linvo目录中的php_skeleton.h、skeleton.c、skeleton.dsp这三个文件,替换内容中所有extname为linvo,EXTNAME为LINVO。(严格区分大小写)

编码:
6、编辑php_skeleton.h文件(头文件)
在PHP_FUNCTION(confirm_linvo_compiled);下面编写
PHP_FUNCTION(hello);
声明一个hello函数

7、编辑skeleton.c文件(主文件)
在PHP_FE(confirm_linvo_compiled,        NULL) 下面编写
PHP_FE(hello,        NULL)
这是函数入口,下面该写函数主体了
找到PHP_FUNCTION(confirm_test_compiled)函数,该函数是测试函数,在该函数后面新写一个函数

  • PHP_FUNCTION(hello)
  • {
  •         char *arg = NULL;
  •         int arg_len, len;
  •         char *strg;

  •     /* 接收参数 */
  •         if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &arg, &arg_len) == FAILURE) {
  •                 return;
  •         }

  •         len = spprintf(&strg, 0, "Hello,%s", arg);
  •     RETURN_STRINGL(strg, len, 0);
  • }


编译:
8、运行cmd命令行,进入d:\php_src\ext\linvo目录
9、输入 msdev linvo.dsp /MAKE "linvo - Win32 Release_TS"
10、如果没有错误,则在php_src目录下会生成一个Release_TS文件夹,里面就是编译好的php_linvo.dll扩展

使用:
11、将其拷入运行环境中的php扩展目录ext
12、编辑php.ini添加extension=php_linvo.dll,重启apache
13、在php文件中执行如下语句
echo hello('Linvo');
将输出
Hello,Linvo
14、通过echo phpinfo();也可看到扩展已加载的信息


刚开始,还没有什么问题,到了编绎的阶段.
出现的error与warning如下:
E:\vc\MSDev98\Bin>msdev D:\php_src\ext\thread\skeleton.dsp /MAKE "thread - Win32
Release_TS"
--------------------Configuration: thread - Win32 Release_TS--------------------
Compiling...
thread.c
E:\Microsoft Visual Studio\VC98\INCLUDE\winsock2.h(99) : error C2011: 'fd_set' :
'struct' type redefinition
E:\Microsoft Visual Studio\VC98\INCLUDE\winsock2.h(134) : warning C4005: 'FD_SET
' : macro redefinition
        E:\Microsoft Visual Studio\VC98\INCLUDE\winsock.h(83) : see previous def
inition of 'FD_SET'
E:\Microsoft Visual Studio\VC98\INCLUDE\winsock2.h(143) : error C2011: 'timeval'
: 'struct' type redefinition
E:\Microsoft Visual Studio\VC98\INCLUDE\winsock2.h(199) : error C2011: 'hostent'
: 'struct' type redefinition
E:\Microsoft Visual Studio\VC98\INCLUDE\winsock2.h(212) : error C2011: 'netent'
: 'struct' type redefinition
E:\Microsoft Visual Studio\VC98\INCLUDE\winsock2.h(219) : error C2011: 'servent'
: 'struct' type redefinition
E:\Microsoft Visual Studio\VC98\INCLUDE\winsock2.h(226) : error C2011: 'protoent
' : 'struct' type redefinition
E:\Microsoft Visual Studio\VC98\INCLUDE\winsock2.h(310) : error C2011: 'in_addr'
: 'struct' type redefinition
E:\Microsoft Visual Studio\VC98\INCLUDE\winsock2.h(368) : error C2011: 'sockaddr
_in' : 'struct' type redefinition
E:\Microsoft Visual Studio\VC98\INCLUDE\winsock2.h(378) : error C2011: 'WSAData'
: 'struct' type redefinition
E:\Microsoft Visual Studio\VC98\INCLUDE\winsock2.h(430) : warning C4005: 'SO_DON
TLINGER' : macro redefinition
        E:\Microsoft Visual Studio\VC98\INCLUDE\winsock.h(391) : see previous de
finition of 'SO_DONTLINGER'
E:\Microsoft Visual Studio\VC98\INCLUDE\winsock2.h(483) : warning C4005: 'AF_IPX
' : macro redefinition
        E:\Microsoft Visual Studio\VC98\INCLUDE\winsock.h(449) : see previous de
finition of 'AF_IPX'
E:\Microsoft Visual Studio\VC98\INCLUDE\winsock2.h(506) : warning C4005: 'AF_MAX
' : macro redefinition
        E:\Microsoft Visual Studio\VC98\INCLUDE\winsock.h(468) : see previous de
finition of 'AF_MAX'
E:\Microsoft Visual Studio\VC98\INCLUDE\winsock2.h(512) : error C2011: 'sockaddr
' : 'struct' type redefinition
E:\Microsoft Visual Studio\VC98\INCLUDE\winsock2.h(521) : error C2011: 'sockprot
o' : 'struct' type redefinition
E:\Microsoft Visual Studio\VC98\INCLUDE\winsock2.h(560) : error C2011: 'linger'
: 'struct' type redefinition
E:\Microsoft Visual Studio\VC98\INCLUDE\winsock2.h(573) : warning C4005: 'SOMAXC
ONN' : macro redefinition
        E:\Microsoft Visual Studio\VC98\INCLUDE\winsock.h(533) : see previous de
finition of 'SOMAXCONN'
E:\Microsoft Visual Studio\VC98\INCLUDE\winsock2.h(598) : warning C4005: 'FD_REA
D' : macro redefinition
        E:\Microsoft Visual Studio\VC98\INCLUDE\winsock.h(551) : see previous de
finition of 'FD_READ'
E:\Microsoft Visual Studio\VC98\INCLUDE\winsock2.h(601) : warning C4005: 'FD_WRI
TE' : macro redefinition
        E:\Microsoft Visual Studio\VC98\INCLUDE\winsock.h(552) : see previous de
finition of 'FD_WRITE'
E:\Microsoft Visual Studio\VC98\INCLUDE\winsock2.h(604) : warning C4005: 'FD_OOB
' : macro redefinition
        E:\Microsoft Visual Studio\VC98\INCLUDE\winsock.h(553) : see previous de
finition of 'FD_OOB'
E:\Microsoft Visual Studio\VC98\INCLUDE\winsock2.h(607) : warning C4005: 'FD_ACC
EPT' : macro redefinition
        E:\Microsoft Visual Studio\VC98\INCLUDE\winsock.h(554) : see previous de
finition of 'FD_ACCEPT'
E:\Microsoft Visual Studio\VC98\INCLUDE\winsock2.h(610) : warning C4005: 'FD_CON
NECT' : macro redefinition
        E:\Microsoft Visual Studio\VC98\INCLUDE\winsock.h(555) : see previous de
finition of 'FD_CONNECT'
E:\Microsoft Visual Studio\VC98\INCLUDE\winsock2.h(613) : warning C4005: 'FD_CLO
SE' : macro redefinition
        E:\Microsoft Visual Studio\VC98\INCLUDE\winsock.h(556) : see previous de
finition of 'FD_CLOSE'
E:\Microsoft Visual Studio\VC98\INCLUDE\winsock2.h(1427) : error C2375: 'accept'
: redefinition; different linkage
        E:\Microsoft Visual Studio\VC98\INCLUDE\winsock.h(707) : see declaration
of 'accept'
E:\Microsoft Visual Studio\VC98\INCLUDE\winsock2.h(1448) : error C2375: 'bind' :
redefinition; different linkage
        E:\Microsoft Visual Studio\VC98\INCLUDE\winsock.h(710) : see declaration
of 'bind'
E:\Microsoft Visual Studio\VC98\INCLUDE\winsock2.h(1467) : error C2375: 'closeso
cket' : redefinition; different linkage
        E:\Microsoft Visual Studio\VC98\INCLUDE\winsock.h(712) : see declaration
of 'closesocket'
E:\Microsoft Visual Studio\VC98\INCLUDE\winsock2.h(1486) : error C2375: 'connect
' : redefinition; different linkage
        E:\Microsoft Visual Studio\VC98\INCLUDE\winsock.h(714) : see declaration
of 'connect'
E:\Microsoft Visual Studio\VC98\INCLUDE\winsock2.h(1507) : error C2375: 'ioctlso
cket' : redefinition; different linkage
        E:\Microsoft Visual Studio\VC98\INCLUDE\winsock.h(716) : see declaration
of 'ioctlsocket'
E:\Microsoft Visual Studio\VC98\INCLUDE\winsock2.h(1528) : error C2375: 'getpeer
name' : redefinition; different linkage
        E:\Microsoft Visual Studio\VC98\INCLUDE\winsock.h(718) : see declaration
of 'getpeername'
E:\Microsoft Visual Studio\VC98\INCLUDE\winsock2.h(1549) : error C2375: 'getsock
name' : redefinition; different linkage
        E:\Microsoft Visual Studio\VC98\INCLUDE\winsock.h(721) : see declaration
of 'getsockname'
E:\Microsoft Visual Studio\VC98\INCLUDE\winsock2.h(1572) : error C2375: 'getsock
opt' : redefinition; different linkage
        E:\Microsoft Visual Studio\VC98\INCLUDE\winsock.h(724) : see declaration
of 'getsockopt'
E:\Microsoft Visual Studio\VC98\INCLUDE\winsock2.h(1593) : error C2375: 'htonl'
: redefinition; different linkage
        E:\Microsoft Visual Studio\VC98\INCLUDE\winsock.h(727) : see declaration
of 'htonl'
E:\Microsoft Visual Studio\VC98\INCLUDE\winsock2.h(1610) : error C2375: 'htons'
: redefinition; different linkage
        E:\Microsoft Visual Studio\VC98\INCLUDE\winsock.h(729) : see declaration
of 'htons'
E:\Microsoft Visual Studio\VC98\INCLUDE\winsock2.h(1627) : error C2375: 'inet_ad
dr' : redefinition; different linkage
        E:\Microsoft Visual Studio\VC98\INCLUDE\winsock.h(731) : see declaration
of 'inet_addr'
E:\Microsoft Visual Studio\VC98\INCLUDE\winsock2.h(1644) : error C2375: 'inet_nt
oa' : redefinition; different linkage
        E:\Microsoft Visual Studio\VC98\INCLUDE\winsock.h(733) : see declaration
of 'inet_ntoa'
E:\Microsoft Visual Studio\VC98\INCLUDE\winsock2.h(1662) : error C2375: 'listen'
: redefinition; different linkage
        E:\Microsoft Visual Studio\VC98\INCLUDE\winsock.h(735) : see declaration
of 'listen'
E:\Microsoft Visual Studio\VC98\INCLUDE\winsock2.h(1680) : error C2375: 'ntohl'
: redefinition; different linkage
        E:\Microsoft Visual Studio\VC98\INCLUDE\winsock.h(737) : see declaration
of 'ntohl'
E:\Microsoft Visual Studio\VC98\INCLUDE\winsock2.h(1697) : error C2375: 'ntohs'
: redefinition; different linkage
        E:\Microsoft Visual Studio\VC98\INCLUDE\winsock.h(739) : see declaration
of 'ntohs'
E:\Microsoft Visual Studio\VC98\INCLUDE\winsock2.h(1717) : error C2375: 'recv' :
redefinition; different linkage
        E:\Microsoft Visual Studio\VC98\INCLUDE\winsock.h(741) : see declaration
of 'recv'
E:\Microsoft Visual Studio\VC98\INCLUDE\winsock2.h(1742) : error C2375: 'recvfro
m' : redefinition; different linkage
        E:\Microsoft Visual Studio\VC98\INCLUDE\winsock.h(743) : see declaration
of 'recvfrom'
E:\Microsoft Visual Studio\VC98\INCLUDE\winsock2.h(1768) : error C2375: 'select'
: redefinition; different linkage
        E:\Microsoft Visual Studio\VC98\INCLUDE\winsock.h(746) : see declaration
of 'select'
E:\Microsoft Visual Studio\VC98\INCLUDE\winsock2.h(1792) : error C2375: 'send' :
redefinition; different linkage
        E:\Microsoft Visual Studio\VC98\INCLUDE\winsock.h(749) : see declaration
of 'send'
E:\Microsoft Visual Studio\VC98\INCLUDE\winsock2.h(1817) : error C2375: 'sendto'
: redefinition; different linkage
        E:\Microsoft Visual Studio\VC98\INCLUDE\winsock.h(751) : see declaration
of 'sendto'
E:\Microsoft Visual Studio\VC98\INCLUDE\winsock2.h(1843) : error C2375: 'setsock
opt' : redefinition; different linkage
        E:\Microsoft Visual Studio\VC98\INCLUDE\winsock.h(754) : see declaration
of 'setsockopt'
E:\Microsoft Visual Studio\VC98\INCLUDE\winsock2.h(1865) : error C2375: 'shutdow
n' : redefinition; different linkage
        E:\Microsoft Visual Studio\VC98\INCLUDE\winsock.h(757) : see declaration
of 'shutdown'
E:\Microsoft Visual Studio\VC98\INCLUDE\winsock2.h(1885) : error C2375: 'socket'
: redefinition; different linkage
        E:\Microsoft Visual Studio\VC98\INCLUDE\winsock.h(759) : see declaration
of 'socket'
E:\Microsoft Visual Studio\VC98\INCLUDE\winsock2.h(1908) : error C2375: 'gethost
byaddr' : redefinition; different linkage
        E:\Microsoft Visual Studio\VC98\INCLUDE\winsock.h(763) : see declaration
of 'gethostbyaddr'
E:\Microsoft Visual Studio\VC98\INCLUDE\winsock2.h(1927) : error C2375: 'gethost
byname' : redefinition; different linkage
        E:\Microsoft Visual Studio\VC98\INCLUDE\winsock.h(766) : see declaration
of 'gethostbyname'
E:\Microsoft Visual Studio\VC98\INCLUDE\winsock2.h(1945) : error C2375: 'gethost
name' : redefinition; different linkage
        E:\Microsoft Visual Studio\VC98\INCLUDE\winsock.h(768) : see declaration
of 'gethostname'
E:\Microsoft Visual Studio\VC98\INCLUDE\winsock2.h(1964) : error C2375: 'getserv
byport' : redefinition; different linkage
        E:\Microsoft Visual Studio\VC98\INCLUDE\winsock.h(770) : see declaration
of 'getservbyport'
E:\Microsoft Visual Studio\VC98\INCLUDE\winsock2.h(1983) : error C2375: 'getserv
byname' : redefinition; different linkage
        E:\Microsoft Visual Studio\VC98\INCLUDE\winsock.h(772) : see declaration
of 'getservbyname'
E:\Microsoft Visual Studio\VC98\INCLUDE\winsock2.h(2001) : error C2375: 'getprot
obynumber' : redefinition; different linkage
        E:\Microsoft Visual Studio\VC98\INCLUDE\winsock.h(775) : see declaration
of 'getprotobynumber'
E:\Microsoft Visual Studio\VC98\INCLUDE\winsock2.h(2018) : error C2375: 'getprot
obyname' : redefinition; different linkage
        E:\Microsoft Visual Studio\VC98\INCLUDE\winsock.h(777) : see declaration
of 'getprotobyname'
E:\Microsoft Visual Studio\VC98\INCLUDE\winsock2.h(2038) : error C2375: 'WSAStar
tup' : redefinition; different linkage
        E:\Microsoft Visual Studio\VC98\INCLUDE\winsock.h(781) : see declaration
of 'WSAStartup'
E:\Microsoft Visual Studio\VC98\INCLUDE\winsock2.h(2056) : error C2375: 'WSAClea
nup' : redefinition; different linkage
        E:\Microsoft Visual Studio\VC98\INCLUDE\winsock.h(783) : see declaration
of 'WSACleanup'
E:\Microsoft Visual Studio\VC98\INCLUDE\winsock2.h(2073) : error C2375: 'WSASetL
astError' : redefinition; different linkage
        E:\Microsoft Visual Studio\VC98\INCLUDE\winsock.h(785) : see declaration
of 'WSASetLastError'
E:\Microsoft Visual Studio\VC98\INCLUDE\winsock2.h(2090) : error C2375: 'WSAGetL
astError' : redefinition; different linkage
        E:\Microsoft Visual Studio\VC98\INCLUDE\winsock.h(787) : see declaration
of 'WSAGetLastError'
E:\Microsoft Visual Studio\VC98\INCLUDE\winsock2.h(2107) : error C2375: 'WSAIsBl
ocking' : redefinition; different linkage
        E:\Microsoft Visual Studio\VC98\INCLUDE\winsock.h(789) : see declaration
of 'WSAIsBlocking'
E:\Microsoft Visual Studio\VC98\INCLUDE\winsock2.h(2124) : error C2375: 'WSAUnho
okBlockingHook' : redefinition; different linkage
        E:\Microsoft Visual Studio\VC98\INCLUDE\winsock.h(791) : see declaration
of 'WSAUnhookBlockingHook'
E:\Microsoft Visual Studio\VC98\INCLUDE\winsock2.h(2141) : error C2375: 'WSASetB
lockingHook' : redefinition; different linkage
        E:\Microsoft Visual Studio\VC98\INCLUDE\winsock.h(793) : see declaration
of 'WSASetBlockingHook'
E:\Microsoft Visual Studio\VC98\INCLUDE\winsock2.h(2158) : error C2375: 'WSACanc
elBlockingCall' : redefinition; different linkage
        E:\Microsoft Visual Studio\VC98\INCLUDE\winsock.h(795) : see declaration
of 'WSACancelBlockingCall'
E:\Microsoft Visual Studio\VC98\INCLUDE\winsock2.h(2180) : error C2375: 'WSAAsyn
cGetServByName' : redefinition; different linkage
        E:\Microsoft Visual Studio\VC98\INCLUDE\winsock.h(797) : see declaration
of 'WSAAsyncGetServByName'
E:\Microsoft Visual Studio\VC98\INCLUDE\winsock2.h(2207) : error C2375: 'WSAAsyn
cGetServByPort' : redefinition; different linkage
        E:\Microsoft Visual Studio\VC98\INCLUDE\winsock.h(802) : see declaration
of 'WSAAsyncGetServByPort'
E:\Microsoft Visual Studio\VC98\INCLUDE\winsock2.h(2233) : error C2375: 'WSAAsyn
cGetProtoByName' : redefinition; different linkage
        E:\Microsoft Visual Studio\VC98\INCLUDE\winsock.h(806) : see declaration
of 'WSAAsyncGetProtoByName'
E:\Microsoft Visual Studio\VC98\INCLUDE\winsock2.h(2258) : error C2375: 'WSAAsyn
cGetProtoByNumber' : redefinition; different linkage
        E:\Microsoft Visual Studio\VC98\INCLUDE\winsock.h(810) : see declaration
of 'WSAAsyncGetProtoByNumber'
E:\Microsoft Visual Studio\VC98\INCLUDE\winsock2.h(2283) : error C2375: 'WSAAsyn
cGetHostByName' : redefinition; different linkage
        E:\Microsoft Visual Studio\VC98\INCLUDE\winsock.h(814) : see declaration
of 'WSAAsyncGetHostByName'
E:\Microsoft Visual Studio\VC98\INCLUDE\winsock2.h(2310) : error C2375: 'WSAAsyn
cGetHostByAddr' : redefinition; different linkage
        E:\Microsoft Visual Studio\VC98\INCLUDE\winsock.h(818) : see declaration
of 'WSAAsyncGetHostByAddr'
E:\Microsoft Visual Studio\VC98\INCLUDE\winsock2.h(2333) : error C2375: 'WSACanc
elAsyncRequest' : redefinition; different linkage
        E:\Microsoft Visual Studio\VC98\INCLUDE\winsock.h(822) : see declaration
of 'WSACancelAsyncRequest'
E:\Microsoft Visual Studio\VC98\INCLUDE\winsock2.h(2353) : error C2375: 'WSAAsyn
cSelect' : redefinition; different linkage
        E:\Microsoft Visual Studio\VC98\INCLUDE\winsock.h(824) : see declaration
of 'WSAAsyncSelect'
D:\php_src\ext\thread\thread.c(163) : error C2065: 'funA' : undeclared identifie
r
D:\php_src\ext\thread\thread.c(163) : warning C4047: 'function' : 'unsigned long
(__stdcall *)(void *)' differs in levels of indirection from 'int '
D:\php_src\ext\thread\thread.c(163) : warning C4024: 'CreateThread' : different
types for formal and actual parameter 3
D:\php_src\ext\thread\thread.c(164) : error C2065: 'funB' : undeclared identifie
r
D:\php_src\ext\thread\thread.c(164) : warning C4047: 'function' : 'unsigned long
(__stdcall *)(void *)' differs in levels of indirection from 'int '
D:\php_src\ext\thread\thread.c(164) : warning C4024: 'CreateThread' : different
types for formal and actual parameter 3
Error executing cl.exe.
php_thread.dll - 60 error(s), 15 warning(s)


分析可知,原来,php的原码改写了C语言很多的头文件...(待续...)

作者: chnzbq   发布时间: 2009-04-18

作者: delinking   发布时间: 2009-04-20

vc6

作者: mataihang   发布时间: 2009-04-21

技术贴要顶啊

作者: 砖头   发布时间: 2009-05-13