views:

97

answers:

1

I opened php_sqlite.dll & php_sockets.dll using Depends.exe. I saw only 1 function in both: get_module

How can I export all functions in extension to dll files when compiling the .dll? AFAIK, ZEND_FUNCTION is used to declare functions in the modules. Please kindly advise. Thank you very much!

+1  A: 

I wouldn't simply expose all functions. If it isn't your extension, just do what zend does - call get_module(), get the function descriptions & function pointers.

If it is your extension however, consider whether you are mainly targeting PHP, C++ or want to support whatever comes your way.
If you are mainly targeting PHP and the C++ access is an exception, just do what zend does. In both other cases a C++ core with just some interfacing to PHP is what you should go for - interface generators like SWIG can ease your job and generate the PHP interface for you.

Georg Fritzsche
hi, thanks for your reply. I target to use php extensions in C++, but not in PHP. I need to use some of those extensions in desktop GUI instead of server environment. And I do development with Nokia Qt C++. PHP has excellent extensions that one should use instead of rewriting.
Viet
Then maybe you should consider using the underlying (C) libraries of that php modules and not the modules themselves.
VolkerK
thanks for suggestion. can you please elaborate more?
Viet
As a sidenote, what exactly do you need from the PHP modules that C++-specific libraries like Boost, POCO or Qt don't have?
Georg Fritzsche
Viet
Maybe, but if you weigh that against the time you'll need to wrap the PHP modules conveniently in C++ (e.g. C++s static typing vs. PHPs dynamic typing) i don't think you benefit from them.
Georg Fritzsche