创建 PHP C/C++使用 SWIG 的扩展模块

发布于 2024-09-04 02:57:06 字数 403 浏览 5 评论 0原文

我使用“老式方式”为 PHP 编写了一些 C/C++ 扩展模块 - 即使用手动方式(如 Sarah Golemon 在她的书中所述)。

这对我来说太繁琐了,因为我很懒,并且希望尽可能自动化。另外,我现在已经使用 SWIG 来生成 Python 扩展,并且我越来越喜欢使用它。

我正在考虑使用 SWIG 来生成我未来的 PHP 扩展。我在生产服务器上使用 PHP v5.2(及更高版本)。

我的问题是:

  1. SWIG PHP 接口是否稳定(即准备好用于生产)?
  2. 如果您对问题 1 的回答是“是”-是否在您的生产站点中使用它?
  3. 使用 SWIG 创建 PHP 扩展、模块时是否有任何我需要注意的“陷阱”?

I have written some C/C++ extension modules for PHP, using the 'old fashioned way' - i.e. by using the manual way (as described by Sarah Golemon in her book).

This is too fiddly for me, and since I am lazy, and would like to automate as much as possible. Also, I have used SWIG now to generate extensions to Python, and I am getting to like using it quite a lot.

I am thinking of using SWIG to generate my future PHP extensions. I am using PHP v5.2 (and above) on my production servers.

My questions are:

  1. Is SWIG PHP interface stable yet (i.e. ready for production)?
  2. If you answered yes to question 1 -are YOU using it in YOUR production site?
  3. Are there any 'gotchas' I need to be aware of when creating PHP extension ,modules using SWIG?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

千と千尋 2024-09-11 02:57:06

我在生产环境中广泛使用 SWIG 来生成 PHP 包装器。它非常稳定,可以毫无问题地使用。

I have extensively used SWIG in production environment for generating PHP wrappers. Its pretty stable and can be used without issues.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文