🌐
Rust-lang
doc.rust-lang.org › cargo › guide
Cargo Guide - The Cargo Book
This guide will give you all that you need to know about how to use Cargo to develop Rust packages.
🌐
Mozilla
mozilla.github.io › firefox-browser-architecture › experiments › 2017-09-06-rust-on-ios.html
Building and Deploying a Rust library on iOS
June 13, 2020 - When you installed Rust, it also installed cargo, which is a package manager similar to pip, gems etc. Now we will use cargo to install cargo-lipo. This is a cargo subcommand which automatically creates a universal library for use with iOS.
🌐
GitHub
github.com › ggez › ggez
GitHub - ggez/ggez: Rust library to create a Good Game Easily
October 16, 2020 - Rust library to create a Good Game Easily. Contribute to ggez/ggez development by creating an account on GitHub.
Starred by 4,3 tys. users
Forked by 420 users
Languages: Rust 96.9% | WGSL 3.1%
🌐
Gitbooks
mmstick.gitbooks.io › rust-programming-phoronix-reader-how-to › content › chapter03.html
Creating the Rust Project | Rust Programming: Creating a Phoronix ...
We will begin by using the cargo tool to create our project directory for us. Of the arguments that you can use, the most important ones are new, build, install and doc. What each argument does should be self-explanatory at this point. By default, the new argument will create a library project, ...
🌐
Rust-lang
users.rust-lang.org › help
Rust can create dll/so/dylib? - help - The Rust Programming Language ...
November 1, 2016 - Hello and greetings, I maintain a desktop API where the deploy is basically a binary library (one for each OS: Windows, Linux and Mac). At this time, does Rust is able to create such libraries during compile time ? Cheers
🌐
www.emqx.com
emqx.com › en › blog › how-to-use-mqtt-in-rust
How to Use MQTT in Rust with Rumqttc Client | EMQ
April 16, 2024 - This article introduces how to use rumqttc client library in the Rust project, and implement the connection, subscription and messaging, etc of MQTT.
🌐
Stack Overflow
stackoverflow.com › questions › 75470213 › how-to-create-a-dynamic-library-compatible-with-c-abi-in-rust
linux - How to create a dynamic library compatible with C ABI in Rust?
February 16, 2023 - I'm new to Rust. For practice I'm trying to create a dynamic library compatible with C ABI in Rust. My use case: I have an existing program written in C and it supports runtime plugins. Basically w...
🌐
Asleson
blog.asleson.org › 2021 › 02 › 23 › how-to-writing-a-c-shared-library-in-rust
How-to: Writing a C shared library in rust - blog.asleson.org
February 23, 2021 - The ability to write a C shared library in rust has been around for some time and there is quite a bit of information about the subject available. Some examples: Exposing C and Rust APIs: some thoughts from librsvg Creating C/C++ APIs in Rust (site removed?) Rust Out Your C by Carol (Nichols ...
🌐
MUO
makeuseof.com › home › programming › how to build a basic http web server in rust
How to Build a Basic HTTP Web Server in Rust
September 4, 2023 - Add Actix as a project dependency in the dependencies section of your Cargo.toml file: ... Choosing a library for your project will depend on your project’s specifications, the features of the library, and your experience with Rust and HTTP. After creating a Rust project and adding any of ...
🌐
My cool site
gauravgahlot.in › rust-dynamic-libraries
How to load dynamic libraries in Rust? - Cloud Native, Community ...
August 13, 2023 - With dynamic library loading, the ... changes to the main program. Rust provides a safe and ergonomic interface for loading dynamic libraries at runtime. The libloading crate provides a cross-platform API for loading dynamic libraries and calling functions defined in those libraries. It also provides a safe wrapper around the dlopen and dlsym functions on Unix-like systems and the LoadLibrary and GetProcAddress functions on Windows. Let’s start by creating a new Rust ...
🌐
Stack Overflow
stackoverflow.com › questions › 76329073 › rust-how-to-configure-a-workspace-of-libraries
Rust, How to configure a workspace of libraries? - Stack Overflow

It seems like rust doesn't let me have a workspace as 'main' project, so instead I solved by adding a new crate that import all workspace members and reexport them with the features key in the Cargo.toml and the #[cfg(feature)] annotation in the lib.rs for each member.

Answer from al3x on stackoverflow.com
🌐
Reddit
reddit.com › r/rust › how to bundle shared libraries to distribute rust binaries
r/rust on Reddit: How to bundle shared libraries to distribute ...

Rust automatically statically links native Rust dependencies, which has that effect.

As for dependencies written in C, it's up to the author of the bindings to provide something like the sdl2 crate's static-link feature flag.

Rust works the same way as C or C++ in that respect... it's just that there's no standard way to ask for static linking in C or C++ because there's no standard build system in C or C++.

(And the reason you need to statically link to bundle C/C++/Rust libraries is because it's the OS that loads dynamic libraries, nor your application, so you're not in the loop when it looks at the filesystem to find them.)

As for GStreamer specifically:

  • On Linux, it's generally expected that you'll depend on the system GStreamer and let your packaging system handle it. (eg. Flatpak provides GStreamer as part of the shared runtime and an org.freedesktop.Sdk.Extension.rust-stable package you can specify as an SDK extension in your manifest to make the rust toolchain available while running flatpak-builder.)

  • On Windows, Inno Setup is the simplest way I know to bundle external library files.

  • On macOS, application distribution is generally a "Package" (Folder with a special extension and metadata file that Finder treats like a single-file executable) inside a .dmg disk image. You need a mac or a CI service which offers macs to build those.

🌐
Stack Overflow
stackoverflow.com › questions › 73835917 › how-to-use-a-single-header-library-c-file-in-rust
How to use a single-header library C file in Rust? - Stack Overflow

You most certainly want to use bindgen to generate the function definitions in Rust from the C header file.

There is an excellent step-by-step tutorial that creates such a binding for the bzip2 library. It should give you an idea of the steps required to achieve what you need.

Answer from Finomnis on stackoverflow.com
🌐
Linuxfixes
linuxfixes.com › 2022 › 07 › solved-how-do-i-create-static-library.html
[SOLVED] How do I create a static library in Rust to link with ...
July 25, 2022 - I want to create static lib in Rust and link the library to main.c. My active toolchain is stable-i686-pc-windows-gnu.