Is there anything like Python's ctype for PHP? Accessing libraries without the need to write an extension?

谁都会走 提交于 2019-11-29 10:23:55

You're looking for ffi.

There is a PHP extension (irony?) called ffi. FFI stands for Foreign Function Interface, which is the generic term for when a language calls libraries written in another language.

PHP 7.3 will have FFI (Foreign Function Interface).

I don't think there is such a thing : in PHP, the "standard" way of using a library is by writting a wrapper arround it, that exports the functions of the library to PHP.

(But maybe an extension could be written to do just what ctypes does ? -- Not sure, but maybe ^^ )

I don't know of any way. But you could let SWIG build an extension for the library you want.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!