@@ -81,7 +81,12 @@ void InitStorageExtension(duckdb::DatabaseInstance &db) {
8181 config.storage_extensions [STORAGE_EXTENSION_KEY] = std::move (ext);
8282}
8383
84+ #ifdef DUCKDB_CPP_EXTENSION_ENTRY
85+ static void LoadInternal (ExtensionLoader &loader) {
86+ auto &instance = loader.GetDatabaseInstance ();
87+ #else
8488static void LoadInternal (DatabaseInstance &instance) {
89+ #endif
8590 InitStorageExtension (instance);
8691
8792 // If the server is already running we need to update the database instance
@@ -128,11 +133,20 @@ static void LoadInternal(DatabaseInstance &instance) {
128133 TableFunction tf (" ui_is_started" , {}, IsUIStartedTableFunc,
129134 internal::SingleBoolResultBind,
130135 RunOnceTableFunctionState::Init);
136+ #ifdef DUCKDB_CPP_EXTENSION_ENTRY
137+ loader.RegisterFunction (tf);
138+ #else
131139 ExtensionUtil::RegisterFunction (instance, tf);
140+ #endif
132141 }
133142}
134143
144+ #ifdef DUCKDB_CPP_EXTENSION_ENTRY
145+ void UiExtension::Load (ExtensionLoader &loader) { LoadInternal (loader); }
146+ #else
135147void UiExtension::Load (DuckDB &db) { LoadInternal (*db.instance ); }
148+ #endif
149+
136150std::string UiExtension::Name () { return " ui" ; }
137151
138152std::string UiExtension::Version () const { return UI_EXTENSION_VERSION; }
@@ -141,10 +155,14 @@ std::string UiExtension::Version() const { return UI_EXTENSION_VERSION; }
141155
142156extern " C" {
143157
158+ #ifdef DUCKDB_CPP_EXTENSION_ENTRY
159+ DUCKDB_CPP_EXTENSION_ENTRY (ui, loader) { duckdb::LoadInternal (loader); }
160+ #else
144161DUCKDB_EXTENSION_API void ui_init (duckdb::DatabaseInstance &db) {
145162 duckdb::DuckDB db_wrapper (db);
146163 db_wrapper.LoadExtension <duckdb::UiExtension>();
147164}
165+ #endif
148166
149167DUCKDB_EXTENSION_API const char *ui_version () {
150168 return duckdb::DuckDB::LibraryVersion ();
0 commit comments