GCC抱怨非标准呼叫约定“ZEND_API” [英] GCC complaining about non-standard calling convention "ZEND_API"

查看:124
本文介绍了GCC抱怨非标准呼叫约定“ZEND_API”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


$ b

  ZEND_API char * zend_strndup(const());在PHP的Zend引擎代码中,我在头文件中看到如下所示的行。 char * s,无符号整型长度)ZEND_ATTRIBUTE_MALLOC; 

我是专业C / C ++编程的新手。

当我尝试使用gcc编译这个包中的c文件时,我得到如下错误:

  zend_alloc.h:55 :error:expected =,,,;,asm或__attribute__ before char 

我试过命令 gcc -I./ -I ../ TSRM zend_language _ *。c



看起来gcc正在抱怨ZEND_API。 ZEND_API指出了什么?任何人都可以帮我弄清楚为什么会出现这个错误?



SVN仓库中的文件所在位置。

是PHP解释器的一部分,不打算与其分开编译。配置脚本应该将 ZEND_API 宏定义为:

  __ attribute__在支持它的系统上((可见性(default)))

(例如GCC 4.0+ ),而在其他编译器上什么也不要。



如果您只是想构建PHP,请从php.net下载整个源代码包并使用 configure / make 来构建它。构建过程非常复杂,并不是显而易见(甚至不可能)手动运行。


In Zend engine code for PHP I see lines like the below in the header files.

ZEND_API char *zend_strndup(const char *s, unsigned int length) ZEND_ATTRIBUTE_MALLOC;

I am new to professional C/C++ programming.

When I try to compile the c files in this package using gcc I get errors like

zend_alloc.h:55: error: expected =, ,, ;, asm or __attribute__ before char

I tried the command gcc -I./ -I../TSRM zend_language_*.c

It looks like gcc is complaing about ZEND_API. What does ZEND_API indicate? Can anyone help me figure out why this error happens?

SVN repository where the files are located.

解决方案

These files are part of the PHP interpreter, and are not intended to be compiled separately from it. The configure script is supposed to define the ZEND_API macro to:

__attribute__ ((visibility("default")))

on systems that support it (e.g, GCC 4.0+), and to nothing on other compilers.

If you're just trying to build PHP, download the whole source bundle from php.net and use configure / make to build it. The build process is complex, and isn't intended to be obvious (or even possible) to run manually.

这篇关于GCC抱怨非标准呼叫约定“ZEND_API”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆