Merge pull request #1431 from gwenn/dll

Use DLL_PREFIX / DLL_SUFFIX
This commit is contained in:
gwenn 2024-01-01 13:21:27 +01:00 committed by GitHub
commit 21d0f98f92
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,16 +1,20 @@
//! Ensure loadable_extension.rs works. //! Ensure loadable_extension.rs works.
use rusqlite::{Connection, Result}; use rusqlite::{Connection, Result};
use std::env::consts::{DLL_PREFIX, DLL_SUFFIX};
fn main() -> Result<()> { fn main() -> Result<()> {
let db = Connection::open_in_memory()?; let db = Connection::open_in_memory()?;
unsafe { unsafe {
db.load_extension_enable()?; db.load_extension_enable()?;
#[cfg(not(windows))] db.load_extension(
db.load_extension("target/debug/examples/libloadable_extension", None)?; format!(
#[cfg(windows)] "target/debug/examples/{}loadable_extension{}",
db.load_extension("target/debug/examples/loadable_extension", None)?; DLL_PREFIX, DLL_SUFFIX
),
None,
)?;
db.load_extension_disable()?; db.load_extension_disable()?;
} }