rust_uno/Library_rust_uno-example.mk |   18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

New commits:
commit 295c988cadd382cc4561c20e646225454a049488
Author:     Mohamed Ali <[email protected]>
AuthorDate: Sun Nov 2 02:12:33 2025 +0200
Commit:     René Engelhard <[email protected]>
CommitDate: Tue Nov 25 10:05:59 2025 +0100

    Rust Bindings: Improve library linking for rust_uno-example
    
    - Add -rpath linker flag with $ORIGIN to enable runtime library path 
resolution
    - Replace absolute library path with -L and -l flags for more flexible 
linking
    - Ensures rust_uno library can be found at runtime without LD_LIBRARY_PATH
    
    Change-Id: I135aa7beb69c69c4d9386eb9d7a6fc3e4d00ba3d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193294
    Reviewed-by: Stephan Bergmann <[email protected]>
    Tested-by: René Engelhard <[email protected]>
    Reviewed-by: René Engelhard <[email protected]>
    Code-Style: René Engelhard <[email protected]>

diff --git a/rust_uno/Library_rust_uno-example.mk 
b/rust_uno/Library_rust_uno-example.mk
index 4f55a5b28296..8c4b5972575b 100644
--- a/rust_uno/Library_rust_uno-example.mk
+++ b/rust_uno/Library_rust_uno-example.mk
@@ -30,8 +30,20 @@ $(eval $(call gb_Library_use_libraries,rust_uno-example, \
 $(eval $(call gb_Library_use_sdk_api,rust_uno-example))
 
 $(call gb_Library_get_target,rust_uno-example): $(call 
gb_CustomTarget_get_target,rust_uno/cargo)
-$(eval $(call gb_Library_add_libs,rust_uno-example,\
-    $(SRCDIR)/rust_uno/target/release/$(if $(filter 
WNT,$(OS_FOR_BUILD)),rust_uno.dll.lib,librust_uno.so) \
-))
+
+ifneq ($(filter WNT,$(OS_FOR_BUILD)),)
+    # Windows-specific flags
+    $(eval $(call gb_Library_add_libs,rust_uno-example,\
+        $(SRCDIR)/rust_uno/target/release/rust_uno.lib \
+    ))
+else
+    # Unix/Linux with RPATH
+    $(eval $(call gb_Library_add_ldflags,rust_uno-example,\
+        -Wl$(COMMA)-rpath$(COMMA)\$$$$ORIGIN \
+    ))
+    $(eval $(call gb_Library_add_libs,rust_uno-example,\
+        -L$(SRCDIR)/rust_uno/target/release -lrust_uno \
+    ))
+endif
 
 # vim: set noet sw=4 ts=4:

Reply via email to