Skip to content

Add more details about extension development? #43

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
TysonAndre opened this issue Sep 19, 2017 · 1 comment
Open

Add more details about extension development? #43

TysonAndre opened this issue Sep 19, 2017 · 1 comment

Comments

@TysonAndre
Copy link
Contributor

"Document and describe how to extend the language with extensions." is mentioned as one of the goals (not sure of plans). The current php.net documentation is sparse in some places(e.g. https://secure.php.net/manual/en/internals2.buildsys.configunix.php is the best resource for config.m4, but https://secure.php.net/manual/en/internals2.faq.php is just a placeholder)

The documentation on php.net doesn't go into much detail beyond simple tasks in my experience. best practices for config.m4/config.w32 aren't documented beyond a single example.
(If one runs into issues, the main resources are PHP's own extensions and other third party code (and maybe mailing lists?))

Miscellaneous thoughts:

  1. Document how to create modules depending on other modules (for shared and static builds) (e.g. via example)

http://www.phpinternalsbook.com/php7/extensions_design/extension_skeleton.html and http://www.phpinternalsbook.com/php7/extensions_design/zend_extensions.html#practice-my-first-example-zend-extension don't go into much detail about config.m4 and config.w32 (or how to modify them if your extension has conditional build arguments) (link to https://secure.php.net/manual/en/internals2.buildsys.configunix.php ?)

The config.m4 macros could be explained somewhere in greater detail (E.g. hyperlink to acinclude.m4 source and mention that it has documentation for ADD_EXTENSION_DEP, etc. The book mentions acinclude.m4 exists, but not that it has documentation)

  1. https://secure.php.net/manual/en/internals2.buildsys.configunix.php and related pages could be linked/quoted for sections on extension development from scratch
  • That example doesn't include ADD_EXTENSION_DEP (I haven't seen any php.net examples that mention ADD_EXTENSION_DEP, in the "Documentation" tab)

  • One thing that the php.net link lacks is details on how to properly create third party extensions that have optional dependencies on other built in/third party extensions. (e.g. which folders to check for shared or static builds in config.m4, etc).
    (Is ADD_EXTENSION_DEP() on its own sufficient for an optional dependency? To check if an optional dependency exists, is code supposed to check the result of HAVE_EXTNAME macro)
    Another section where a second extension conditionally depends on the first extension may be useful.

  1. Could link to relevant examples of config.m4/config.w32 from php-src/ext, to give developers a real application of macros?

Other notes.

  • Documenting ADD_EXTENSION_DEP may be more appropriate as a task for php.net documentation, or both
  • Some of these issues I've had are specific to me and work on igbinary, possibly not broadly applicable (e.g. where would one look for headers in config.m4 so that an extension dependency would work in both a shared/static build (e.g. finding apcu headers from igbinary's config.m4)
@Jeckerson
Copy link

Jeckerson commented Apr 3, 2021

Hello

Document how to create modules depending on other modules (for shared and static builds) (e.g. via example)

Yes please!

Especially: how to link external extension via .dll.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants