frankenphp icon indicating copy to clipboard operation
frankenphp copied to clipboard

extgen: Add support for init/minit/mshutdown

Open withinboredom opened this issue 5 months ago • 3 comments

This PR adjusts extgen to handle:

  • the case where the go code already contains an init() function.
  • support for //export_php:module init to handle resource creation during module startup
  • support for //export_php:module shutdown to handle resource cleanup during module shutdown

withinboredom avatar Aug 03 '25 19:08 withinboredom

My last commit breaks classes, but is needed for functions-only extensions. I'll need to make that import conditional on whether or not there are classes present and add a test for it.

withinboredom avatar Aug 07 '25 10:08 withinboredom

This one is probably ready for review now @dunglas

withinboredom avatar Aug 09 '25 20:08 withinboredom

This is really nice and certainly useful. Thanks!

Bikeshedding: should we call the directives //export_php:minit and mshutdown to match PHP's macros? Your proposition also suits me fine. It's just to see if someone would prefer this 🙂

alexandre-daubois avatar Aug 11 '25 09:08 alexandre-daubois