Skip to content

Conversation

@alexandre-daubois
Copy link
Member

The DX is currently not optimal as we need to touch and edit the original source file. It is still in WIP, but this PR aims to improve a lot the DX of the extension generator by making it idempotent.

The proposed approach is to generate a wrapper to the original source file that will call it and then make the bindings to C. The original Go source will remain untouched and the generator can be run multiple times easily.

This also adds a header comment to all generated files (C file, C headers et al.):

package ext

// AUTOGENERATED FILE - DO NOT EDIT.
//
// This file has been automatically generated by FrankenPHP extension generator
// and should not be edited as it will be overwritten when running the
// extension generator again.
//
// You may edit the file and remove this comment if you plan to manually maintain
// this file going forward.

// #include <stdlib.h>
// #include "ext.h"
import "C"

// rest of the file...

@alexandre-daubois
Copy link
Member Author

Requires #2086 to be merged first

@alexandre-daubois alexandre-daubois force-pushed the extgen-idempotent branch 2 times, most recently from b482106 to 30b21c9 Compare December 26, 2025 09:53
alexandre-daubois added a commit that referenced this pull request Jan 12, 2026
…2086)

While continuing the work on #2011, I realized that constant
declarations have a problem when using `iota`. I mean, it technically
works, but const *blocks* we not supported which means that setting all
constants to `iota` as shown in the documentation was non-sensical, as
`iota` resets every time outside of const blocks.

So, this is between the bug fix and the feature. To me, it's a bug fix
as the behavior wasn't the one intended when creating extgen.
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

Successfully merging this pull request may close these issues.

2 participants