אליהו הדס
01/03/2025, 5:33 AMlibui
working with Kotlin Native. I forked an existing project of @Dominaezzz , but it was using an older Kotlin version (1.7.20). I managed to update it to Kotlin 1.9.10, but moving to Kotlin 1.9.20 causes binding errors.
There’s also an attempt to create a Compose-based version, which worked fine with Kotlin 1.7.20, but now crashes after the update.
I’ve documented the issues and opened GitHub issues here:
https://github.com/kdroidFilter/kotlin-libui-compose/issues
Would anyone be willing to help or share ideas to resolve these issues? 🙏🏻
Thank you so much!Thomas
01/05/2025, 11:22 PMmeson setup build --default-library=static --buildtype=release -Db_ndebug=true
ninja -C build
I am using static linking for my project
My def file looks like this
package = libui
headers = ui.h
headers.mingw = windows.h ui_windows.h
headerFilter = ui.h ui_windows.h
noStringConversion = uiFreeInitError
linkerOpts.osx = -lobjc -framework Foundation -framework AppKit
linkerOpts.linux = -L/usr/lib/x86_64-linux-gnu -L/usr/lib64 -L/usr/lib \
-lgtk-3 -lgdk-3 -latk-1.0 -lgio-2.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 \
-lcairo-gobject -lpango-1.0 -lcairo -lgobject-2.0 -lglib-2.0 -lm -ldl
linkerOpts.mingw = -luser32 -lkernel32 -lgdi32 -lcomctl32 -luxtheme \
-lmsimg32 -lcomdlg32 -ld2d1 -ldwrite -lole32 -loleaut32 -loleacc -luuid -lwindowscodecs
# libraryPaths is set in build.gradle.kts
staticLibraries = build/meson-out/libui.a
---
struct ktAreaHandler {
uiAreaHandler ui;
void *ref;
};
struct ktTableHandler {
uiTableModelHandler ui;
void *ref;
};
// Avoid types ending up in cnames.structs.* <https://youtrack.jetbrains.com/issue/KT-49034>
typedef struct uiArea {} uiArea;
typedef struct uiWindow {} uiWindow;
#ifdef _WIN32
struct uiWindowForIcon {
uiWindowsControl c;
HWND hwnd;
};
#endif
Thomas
01/05/2025, 11:23 PMcommandLine(
"C:\\msys64\\usr\\bin\\env",
"MSYSTEM=MINGW64",
"/usr/bin/bash",
"-lc",
"cd ${workingDir.absolutePath.fixPath()} && $cmdWithArgs"
)
fun String.fixPath(): String {
return if (isWindows) {
replace("\\", "/")
.replace("C:/", "/c/")
.replace("D:/", "/d/")
} else {
this
}
}
Thomas
01/05/2025, 11:24 PMcinterops.create("libui") {
val dir = libuiDir.get().dir("libui-ng-$libuiCommit")
includeDirs(dir)
extraOpts("-libraryPath", dir)
}
Thomas
01/05/2025, 11:25 PMThomas
01/05/2025, 11:26 PM