undeflife / libreoffice-rs

Rust binding to LibreOfficeKit
Apache License 2.0
15 stars 7 forks source link

Enhancement - Support builds for arm64/aarch64 #12

Closed yveszoundi closed 2 years ago

yveszoundi commented 2 years ago

Overview

It is not currently possible to build programs successfully for non amd64 architectures (such as aarch64/arm64). This is due to data type assumptions in implemented LibreOfficeKit registration callbacks. Those assumptions are not true for all CPU architectures.

My goal is to begin shipping multi-arch container images for my application (starting with arm64 support).

Proposed changes and impacts

Proposed change

Update the LibreOfficeKitCallback handler signature

register_callback<F: FnMut(i32, *const i8) ===> register_callback<F: FnMut(std::os::raw::c_int, *const std::os::raw::c_char)

The rust compiler will automatically determine what c_int and c_char mean on either amd64 or aarch64.

Impact

Technically there are no user visible changes, unless developers were explicitly manipulating the callback parameters. The callback parameters themselves are not really useful at this time (random ID and random "garbage text" upon subsequent application runs).

Verifying the changes