PHP_FUNCTION(myFun)
{
    RETURN_NULL();
}basic_functions.c:
在function_entry basic_functions[] = { 中加入以下一行:
PHP_FE(myfun, NULL)basic_functions.h里加入
PHP_FUNCTION(myfun);
注意有些版本的函数名是区分大小写的。
请关注我的BLOG:http://blog.csdn.net/ezdevelop/

解决方案 »

  1.   

    to  ezdevelop(phpsalon.com):
    按照你的方法试了,但还是报错:
    ext/standard/basic_functions.lo: In function `zif_get_current_user':
    /usr/local/php-4.3.4/ext/standard/basic_functions.c:1619: undefined reference to `zif_uploadPendingOrder'
    collect2: ld returned 1 exit status
    make: *** [sapi/cli/php] Error 1我也看了你的BLOG,你里面有篇是如何进行PHP扩展的,但是我希望在仅仅是能够定义EXPORTING函数,这样我就可以在PHP中使用这些函数了,而这些函数又调用了另外一个库,好象在4.0.0中有成功的例子,但我的是4.3.4的,怎么也编译不通过,能不能再帮我想想。
      

  2.   

    /* {{{ proto string get_current_user(void)
       Get the name of the owner of the current PHP script */
    PHP_FUNCTION(get_current_user)
    {
    if (ZEND_NUM_ARGS() != 0) {
    WRONG_PARAM_COUNT;
    } RETURN_STRING(php_get_current_user(), 1); //1619行
    }我在C文件里void myFun()和void zif_myFun()都试过,报一样的错。
    PHP_FUNCTION(myFun)也试了,还是一样的错。如果单独做一个外部扩展需要注意些什么呢?
      

  3.   

    basic_functions.c:
    在function_entry basic_functions[] = { 中加入以下一行:
    PHP_FE(get_current_user, NULL)basic_functions.h里加入
    PHP_FUNCTION(get_current_user);
      

  4.   

    会不会我在makefile里写错了,但好象也不应该会错呀!奇怪!
      

  5.   

    重新再来一次
    1、basic_functions.c:
    在function_entry basic_functions[] = { 中加入以下一行:
    PHP_FE(myfun, NULL)2、basic_functions.c: 加入函数
    PHP_FUNCTION(myfun)
    {
        RETURN_STRING("test", 1);
    }
    3、basic_functions.h里加入
    PHP_FUNCTION(myfun);其他都不要动试一下吧
      

  6.   

    成功!但是这是把函数写在basic_functions.c中了呀难道我要把myFunction.c里的函数全部都重新写一遍到basic_functions.c中?
      

  7.   

    还是建议你单独写一个扩展吧,可以参考我的BLOG上的文章。