如何开发供PHP调用的so模块?

一个懂技术的项目经理 2004-11-24 10:29:21
我自己开发了一个so给php加载,但是提示
Invalid library (maybe not a PHP library)
是不是开发要有一定的规范?应该符合什么样的规范呐?
...全文
115 7 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
clansoft 2004-12-19
  • 打赏
  • 举报
回复
期待答案
上边的代码我试过了,php.net 给的编译方法根本不能通过,路经都不相符,还会报少头文件

alloca.h 等等.
raid79 2004-11-24
  • 打赏
  • 举报
回复
关注
boris2002 2004-11-24
  • 打赏
  • 举报
回复
手册里的例子(我也看不明白):

/* include standard header */
#include "php.h"

/* declaration of functions to be exported */
ZEND_FUNCTION(first_module);

/* compiled function list so Zend knows what's in this module */
zend_function_entry firstmod_functions[] =
{
ZEND_FE(first_module, NULL)
{NULL, NULL, NULL}
};

/* compiled module information */
zend_module_entry firstmod_module_entry =
{
STANDARD_MODULE_HEADER,
"First Module",
firstmod_functions,
NULL,
NULL,
NULL,
NULL,
NULL,
NO_VERSION_YET,
STANDARD_MODULE_PROPERTIES
};

/* implement standard "stub" routine to introduce ourselves to Zend */
#if COMPILE_DL_FIRST_MODULE
ZEND_GET_MODULE(firstmod)
#endif

/* implement function that is meant to be made available to PHP */
ZEND_FUNCTION(first_module)
{
long parameter;

if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", ¶meter) == FAILURE) {
return;
}

RETURN_LONG(parameter);
}
-神仙- 2004-11-24
  • 打赏
  • 举报
回复
手册里有说明的
只是我也看着不怎么明白
522jack 2004-11-24
  • 打赏
  • 举报
回复
不知道。
ezdevelop 2004-11-24
  • 打赏
  • 举报
回复
少个
#if COMPILE_DL_YOUREXT
ZEND_GET_MODULE(yourext)
#endif
  • 打赏
  • 举报
回复
高手高手快快现身帮帮小弟哟.

21,893

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧