Skip to content

Commit 37180b7

Browse files
Follow-up: Increase required C API and database version #147
Also refer to database instead of core and note the version_is_at_least check actually only checks the C API version. Also update version check failure message to hint library also needs updating to run unit tests. Follow-up to 4996b7a Update C library [4.1.0 -> 4.2.0]
1 parent 3791870 commit 37180b7

File tree

2 files changed

+22
-19
lines changed

2 files changed

+22
-19
lines changed

dev-doc/updating-c-library.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ for Flutter (`flutter_libs` and `sync_flutter_libs` plugins) on Linux and Window
2828

2929
```text
3030
Update C library [4.1.0 -> 4.2.0]
31+
32+
Includes database 4.2.0-2025-03-04
3133
```
3234

3335
### Android
@@ -47,7 +49,7 @@ For the Flutter plugins on Android ([view releases](https://github.com/objectbox
4749
```text
4850
Update objectbox-android [4.1.0 -> 4.2.0]
4951
50-
Bundled with C API 4.2.0 and ObjectBox 4.2.0-2025-03-04
52+
Includes C API 4.2.0 and database 4.2.0-2025-03-04
5153
```
5254

5355
Note: the embedded C API and ObjectBox version can be looked up
@@ -69,7 +71,7 @@ For the Flutter plugins on iOS/macOS ([view releases](https://github.com/objectb
6971
```text
7072
Update ObjectBox Swift [4.1.0 -> 4.2.0]
7173
72-
Bundled with C API 4.2.0 and ObjectBox 4.2.0-2025-03-04
74+
Includes C API 4.2.0 and database 4.2.0-2025-03-27
7375
```
7476

7577
Note: the embedded C API and ObjectBox version can be looked up

objectbox/lib/src/native/bindings/bindings.dart

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -94,29 +94,30 @@ ObjectBoxC? _tryObjectBoxLibFile() {
9494

9595
// Require the minimum C API version of all supported platform-specific
9696
// libraries.
97-
// Library | C API | Core
97+
// Library | C API | Database
9898
// ------------------------|-------|-----------------
99-
// objectbox-c | 4.1.0 | 4.1.0-2025-01-28
100-
// ObjectBox Swift 4.1.0 | 4.1.0 | 4.1.0-2025-01-30
101-
// objectbox-android 4.1.0 | 4.1.0 | 4.1.0-2025-01-28
99+
// objectbox-c | 4.2.0 | 4.2.0-2025-03-04
100+
// ObjectBox Swift 4.2.0 | 4.2.0 | 4.2.0-2025-03-27
101+
// objectbox-android 4.2.0 | 4.2.0 | 4.2.0-2025-03-04
102102
var _obxCminMajor = 4;
103-
var _obxCminMinor = 1;
103+
var _obxCminMinor = 2;
104104
var _obxCminPatch = 0;
105-
// Require minimum core version guaranteeing actual C API availability.
106-
var _obxCoreMinVersion = "4.1.0-2025-01-28";
105+
// Require minimum database version guaranteeing actual C API availability.
106+
var _obxDatabaseMinVersion = "4.2.0-2025-03-04";
107107

108108
bool _isSupportedVersion(ObjectBoxC obxc) {
109+
// Require a minimum C API version
109110
if (!obxc.version_is_at_least(_obxCminMajor, _obxCminMinor, _obxCminPatch)) {
110111
return false;
111112
}
112-
// Require a minimum core version.
113-
// As the core version string uses the
113+
// Require a minimum database version.
114+
// As the database version string uses the
114115
// "major.minor.build-YYYY-MM-DD (<flags>)"
115116
// format it should have a stable order.
116117
// Note: if the version+date is the same the compare value will be negative as
117118
// the flags make the string longer than the expected min version+date string.
118-
final coreVersion = dartStringFromC(obxc.version_core_string());
119-
return _obxCoreMinVersion.compareTo(coreVersion) <= 0;
119+
final databaseVersion = dartStringFromC(obxc.version_core_string());
120+
return _obxDatabaseMinVersion.compareTo(databaseVersion) <= 0;
120121
}
121122

122123
ObjectBoxC loadObjectBoxLib() {
@@ -126,17 +127,17 @@ ObjectBoxC loadObjectBoxLib() {
126127

127128
if (obxc == null) {
128129
throw UnsupportedError(
129-
'Could not load ObjectBox core dynamic library. Platform: ${Platform.operatingSystem}');
130+
'Could not load ObjectBox dynamic database library. Platform: ${Platform.operatingSystem}');
130131
}
131132

132133
if (!_isSupportedVersion(obxc)) {
133134
final version = dartStringFromC(obxc.version_string());
134-
final coreVersion = dartStringFromC(obxc.version_core_string());
135+
final databaseVersion = dartStringFromC(obxc.version_core_string());
135136
throw UnsupportedError(
136-
'ObjectBox platform-specific library not compatible: is $version ($coreVersion),'
137-
' expected $_obxCminMajor.$_obxCminMinor.$_obxCminPatch ($_obxCoreMinVersion) or newer.'
138-
' For Flutter, check if the ObjectBox Pod or objectbox-android-objectbrowser need to be updated.'
139-
' For Dart, re-run the install.sh script to download the latest version.');
137+
'ObjectBox platform-specific database library not compatible: is $version ($databaseVersion),'
138+
' expected $_obxCminMajor.$_obxCminMinor.$_obxCminPatch ($_obxDatabaseMinVersion) or newer.'
139+
' For Flutter apps, check if the ObjectBox Pod or the Android Admin dependency need to be updated.'
140+
' For unit tests or Dart Native apps, re-run the install.sh script to download the latest version.');
140141
}
141142

142143
return obxc;

0 commit comments

Comments
 (0)