Convert to C-API based extension#20
Merged
Merged
Conversation
samansmink
reviewed
Sep 19, 2025
| # Set to 1 to enable Unstable API (binaries will only work on TARGET_DUCKDB_VERSION, forwards compatibility will be broken) | ||
| # WARNING: When set to 1, the duckdb_extension.h from the TARGET_DUCKDB_VERSION must be used, using any other version of | ||
| # the header is unsafe. | ||
| USE_UNSTABLE_C_API=1 |
Member
There was a problem hiding this comment.
Does it make sense to open an issue that lists all the C API functions that we need to stabilize to be able to switch inet to the stable C API?
Member
Author
There was a problem hiding this comment.
Yeah we can do that - In this case I don't think inet actually needs any unstable changes, but there is technically a behavior change related to registering overloads (thats only available on upstream main), so I kept it as unstable just to signal that this won't work with any "stable" c-api build. Or rather, it won't work with all duckdb versions that provides the stable api, only those post v1.4.
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR converts the
inetextension to be fully based on DuckDB's extension C-API. It also converts all code to c, from c++.This makes maintenance much easier as it no longer depends on any (frequently changing) DuckDB-internal code. Additionally it significantly improves the build-time and the size of the extension. A release build is about
325Kon my machine, compared to the6.7Mbinary we distribute for DuckDB v1.3.2.While most of the code has been relatively straightforward to port c (e.g.
ipaddress.cpp/hpp), I've reworked thehtml_unescapefunction significantly by making use of a static pre-generated perfect-hash-table to decode html entities, which should be faster, and avoids dynamic initialization and copying of the map in the function bind data. But the behavior should be the same.It also includes the changes in #19