ÓÃphpµÄcÀ©Õ¹±à³Ìµ÷Óà c³ÌÐòµÄ¶¯Ì¬Á´½Ó¿â
Ò». Ê×ÏÈ×öÒ»¸ö¼òµ¥µÄsoÎļþ£º
/**
* hello.c
* To compile, use following commands:
* gcc -O -c -fPIC -o hello.o hello.c
* gcc -shared -o libhello.so hello.o
*/
int hello_add(int a, int b)
{
return a + b;
}
È»ºó½«Ëü±àÒë³É.soÎļþ²¢·Åµ½ÏµÍ³ÖУº
$ gcc -O -c -fPIC -o hello.o hello.c
$ gcc -shared -o libhello.so hello.o
$ su
# echo /usr/local/lib > /etc/ld.so.conf.d/local.conf
# cp libhello.so /usr/local/lib
# /sbin/ldconfig
¶þ. д¶ÎС³ÌÐòÀ´ÑéÖ¤ÆäÕýÈ·ÐÔ£º
/**
* hellotest.c
* To compile, use following commands:
* gcc -o hellotest -lhello hellotest.c
*/
#include <stdio.h>
int main()
{
int a = 3, b = 4;
printf("%d + %d = %d\n", a, b, hello_add(a,b));
return 0;
}
±àÒë²¢Ö´ÐУº
$ gcc -o hellotest -lhello hellotest.c
$ ./hellotest
3 + 4 = 7
Èý.
È»ºóͨ¹ýÏÂÃæµÄÃüÁÁ¢Ò»¸öÃûΪ hello µÄÄ£¿é¡£
$ ./ext_skel --extname=hello
Ö´ÐиÃÃüÁîÖ®ºóËü»áÌáʾÄãÓ¦µ±ÓÃʲôÃüÁîÀ´±àÒëÄ£¿é£¬¿ÉϧÄÇÊǽ«Ä£¿é¼¯³Éµ½phpÄÚ²¿µÄ±àÒë·½·¨¡£Èç¹ûÒª±àÒë³É¿É¶¯Ì¬¼ÓÔØµÄ php_hello.so£¬·½·¨Òª¸üΪ¼òµ¥¡£
$ cd hello
Ê×Ïȱ༠config.m4 Îļþ£¬È¥µôµÚ16Ðк͵Ú18ÐÐ
Ïà¹ØÎĵµ£º
1.¸Ä±äÕû¸ö¿ØÖÆÌ¨µÄÑÕÉ«
ÓÃ system("color 0A");
ÆäÖÐcolorºóÃæµÄ0ÊDZ³¾°É«´úºÅ£¬AÊÇǰ¾°É«´úºÅ¡£¸÷ÑÕÉ«´úÂëÈçÏ£º
0=ºÚÉ«
1=À¶É«
2=ÂÌÉ«
3=ºþÀ¶É«
4=ºìÉ«
5=×ÏÉ«
6=»ÆÉ«
7=°×É«
8=»ÒÉ«
9=µÀ¶É«
A=µÂÌÉ«
B=µÇ³ÂÌÉ«
C=µºìÉ«
D=µ×ÏÉ«
E=µ»ÆÉ«
F=ÁÁ°×É«
2.¸Ä±äÏÂÒ»¸öÊä³ ......
º¯ÊýÃû: stpcpy
¹¦ ÄÜ: ¿½±´Ò»¸ö×Ö·û´®µ½ÁíÒ»¸ö
ÓÃ ·¨: char *stpcpy(char *destin, char *source);
³ÌÐòÀý:
#include <stdio.h>
#include <string.h>
int main(void)
{
char string[10];
char *str1 = "abcdefghi";
stpcpy(string, str1);
& ......
»·¾³Èí¼þ°æ±¾½éÉÜ£º
APACHE 2.0.59
PHP5.2.3
MYSQL5.0.45
GD-2.0.35
Zend Optimizer v3.3.0
&n ......
Ò». Ê×ÏÈ×öÒ»¸ö¼òµ¥µÄsoÎļþ£º
/**
* hello.c
* To compile, use following commands:
* gcc -O -c -fPIC -o hello.o hello.c
* gcc -shared ......