如何使用 Vala 编程语言制作 PHP 模块?
这种名为 Vala 的新语言据说类似于 C#,并且比 C++ 或 C 更容易,可以在 Linux 上使用 GCC 编译器编译为 C。
听起来很棒。现在我想用它来制作一个PHP扩展模块,以便可以在Vala中制作慢速PHP代码并将其作为函数导入到PHP中。
我如何在 Vala 中实现这一目标?有可能吗?
This new language called Vala, which is said to be C#-like and supposedly easier than C++ or C, compiles down into C on Linux with the GCC compiler.
Sounds great. Now I want to use it to make a PHP extension module so that slow PHP code can be made in Vala and imported into PHP as a function.
How do I accomplish this in Vala? Is it even possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我创建了如何使用其他语言的 Vala 库的简单示例:
https://github.com/antono /vala-object
通过 GOobject Introspection 自动生成的 vala 库的绑定。
https://live.gnome.org/GObjectIntrospection
使用 gobject-for-php 并免费获取绑定!
https://github.com/indeyets/gobject-for-php
I've created simple example of how to use Vala library from other languages:
https://github.com/antono/vala-object
Bindings for vala library generated automagically via GOobject Introspection.
https://live.gnome.org/GObjectIntrospection
Use gobject-for-php and get bindings for free!
https://github.com/indeyets/gobject-for-php
我不知道 Vala,但如果您可以调用本机代码,声明 C 结构并将它们作为指向所述本机代码的指针传递,并定义使用 C 调用约定的函数,那么它应该是可能的。但用 C/C++ 肯定会更容易。
编辑:其 主页 说
所以,虽然这不是确定的,但我想说你可能可以。
I don't know Vala, but if you can call native code, declare C structures and pass them as pointers to said native code, and define functions that use C calling conventions, it should be possible. But it will certainly be easier to do it in C/C++.
Edit: its homepage says
So, although this is not definitive, I'd say you probably can.
您需要为您需要使用的 C 库使用或编写(如果不存在)VAPI 文件。
这很简单,您只需要观看现有的示例:http://live.gnome.org/Vala /Bindings 或简单地:http://git.gnome.org/browse/瓦拉/树/vapi
You need to use or write (if it doesn't exist) a VAPI file for the C library you need to use.
It's quite easy, you just need to watch at the existing examples: http://live.gnome.org/Vala/Bindings or simply: http://git.gnome.org/browse/vala/tree/vapi