开发者

is it possible to have multiple classes inside php extension?

I would like to wrapp a .cc code that contains multiple public cl开发者_StackOverflowasses. Is it possible to do that ? how? Do I need to use multiple .cc files one for each class that i want to wrapp?

THX


You want to call a C++ class from php? This is incredibly difficult. Usually you have to write a php module (a lot of work). Alternatively you could take a look at Thrift which would let you call your C++ code as a network service (sounds hard, but trust me it's easier than writing a php module).


I wonder what you are attempting to do... if motives were mentioned may be we can help better. Anyways....

To execute a compiled application you can use execute();

$output = exec('/path/to/your/app');

Besides that, you can always write your own php extension....

Check out these tutorials

  • http://devzone.zend.com/article/1021
  • http://devzone.zend.com/article/4486-Wrapping-C-Classes-in-a-PHP-Extension
  • http://www.devnetwork.net/viewtopic.php?f=14&t=89796
  • http://www.devarticles.com/c/a/Cplusplus/Developing-Custom-PHP-Extensions-Part-1/

AFAIK, Many developers use PHP to execute C functions, because it boosts performance quite remarkably.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜