-
Notifications
You must be signed in to change notification settings - Fork 194
codegen only used functions in duckdb C API #8491
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,45 +1,24 @@ | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
| // SPDX-FileCopyrightText: Copyright the Vortex contributors | ||
|
|
||
| // | ||
| // THIS FILE IS AUTO-GENERATED, DO NOT MAKE EDITS DIRECTLY | ||
| // | ||
|
|
||
| // clang-format off | ||
|
|
||
| #ifdef __cplusplus | ||
| extern "C" { | ||
| #endif | ||
|
|
||
| #include "duckdb.h" | ||
|
|
||
|
|
||
| #pragma once | ||
|
|
||
| #ifdef __cplusplus | ||
| extern "C" { | ||
| #endif // __cplusplus | ||
|
|
||
| /** | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How come these are dropped and why?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We had had a double check: one in cbingden option, other in header/trailer. I've removed the hand-written one. |
||
| * Global symbol visibility in the Vortex extension: | ||
| * - Rust functions use C ABI with "_rust" suffix (e.g., vortex_init_rust) | ||
| * - C++ wrapper functions have the expected name without suffix (e.g., vortex_init) | ||
| * - C++ wrappers are annotated with DUCKDB_EXTENSION_API to ensure global visibility | ||
| * - C++ wrappers call the corresponding Rust functions | ||
| * | ||
| * This ensures DuckDB can find the symbols when loading the extension. | ||
| * | ||
| * The DuckDB extension ABI initialization function. | ||
| */ | ||
| extern void vortex_init_rust(duckdb_database db); | ||
|
|
||
| /** | ||
| * The DuckDB extension ABI version function. | ||
| * This function returns the version of the DuckDB library the extension is built against. | ||
| */ | ||
| extern const char *vortex_version_rust(void); | ||
|
|
||
| /** | ||
| * An additional function we export to expose the version of the extension itself to C++ code. | ||
| */ | ||
| extern const char *vortex_extension_version_rust(void); | ||
|
|
||
| extern void duckdb_table_function_to_string(void *bind_data, duckdb_vx_string_map map); | ||
|
|
@@ -112,8 +91,4 @@ extern void duckdb_copy_function_copy_to_finalize(void *global_data, duckdb_vx_e | |
| } // extern "C" | ||
| #endif // __cplusplus | ||
|
|
||
| #ifdef __cplusplus | ||
| } | ||
| #endif | ||
|
|
||
| // clang-format on | ||
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The binary gets smaller but also all API is now hidden behind having to change the build.rs when not exposed explicitly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want to extend Rust API, you still likely need to look into duckdb.h/.hpp, and you need to write a Rust wrapper over Rust unsafe {} functions, so we're not losing anything here.