[v2] Why Doesn't tauri build Output a Dynamic Library? How to Configure It? #11585
-
BackgroundI'm working on a Tauri v2 project where I need to create a dynamic library (DLL) with an additional C API that invokes ProblemWhen I use Example SetupHere’s a simplified version of my project structure and code: # src-tauri/Cargo.toml
[lib]
name = "my_app_lib"
crate-type = ["lib", "cdylib", "staticlib"] // src-tauri/src/lib.rs
#[tauri::command]
fn greet(name: &str) -> String {
format!("Hello, {}! You've been greeted from Rust!", name)
}
#[no_mangle]
pub extern "C" fn initialize() {
run();
}
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
tauri::Builder::default()
.plugin(tauri_plugin_shell::init())
.invoke_handler(tauri::generate_handler![greet])
.run(tauri::generate_context!())
.expect("error while running tauri application");
} |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Try |
Beta Was this translation helpful? Give feedback.
Try
cargo build --release --features tauri/custom-protocol
- this will be equivalent totauri build
== using the distDir/frontendDist instead of devPath/devUrl which i assume was what caused ERR_CONNECTION_REFUSED