我想编写C代码以及PHP如何调用C动态库?
例如:
文件hello.c
int cc_add(int a,int b){
return a + b ;
}
将代码编译到动态链接库中,并更新动态库信息。
gcc -O -c -fPIC -o hello.o hello.c
gcc -shared -o libhello.so hello.o
echo /usr/local/lib > /etc/ld.so.conf.d/local.conf
cp libhello.so /usr/local/lib
/sbin/ldconfig
建立一个模块(使用了ext_skel --extname = hello的php 5.6.4。)
./ext_skel --extname=hello
cc hello
等等,但我不知道该怎么办? 希望你能给我一些例子。