1use photodna_sys::*;
11
12fn main() {
13 println!("PhotoDNA-sys Example");
14 println!("====================");
15 println!();
16
17 #[cfg(all(
19 any(target_os = "windows", target_os = "linux", target_os = "macos"),
20 not(photodna_no_sdk)
21 ))]
22 {
23 println!("SDK Root: {}", PHOTODNA_SDK_ROOT);
24 println!("Library Directory: {}", PHOTODNA_LIB_DIR);
25 println!();
26 }
27
28 #[cfg(any(
29 not(any(target_os = "windows", target_os = "linux", target_os = "macos")),
30 photodna_no_sdk
31 ))]
32 {
33 println!("SDK paths not available (build without SDK or BSD/WASM-only build)");
34 println!();
35 }
36
37 #[cfg(any(target_os = "windows", target_os = "linux", target_os = "macos"))]
38 {
39 println!("Attempting to load PhotoDNA library...");
40
41 match EdgeHashGenerator::new(None, 4) {
42 Ok(lib) => {
43 println!("✓ Library loaded successfully!");
44 println!();
45 println!("Library Version Information:");
46 println!(" Version (packed): 0x{:08x}", lib.library_version());
47 println!(" Major: {}", lib.library_version_major());
48 println!(" Minor: {}", lib.library_version_minor());
49 println!(" Patch: {}", lib.library_version_patch());
50 if let Some(text) = lib.library_version_text() {
51 println!(" Text: {}", text);
52 }
53 println!();
54 println!("Hash sizes:");
55 println!(" Edge V2 (binary): {} bytes", PHOTODNA_HASH_SIZE_EDGE_V2);
56 println!(
57 " Edge V2 (base64): {} bytes",
58 PHOTODNA_HASH_SIZE_EDGE_V2_BASE64
59 );
60 }
61 Err(e) => {
62 eprintln!("✗ Failed to load library: {}", e);
63 std::process::exit(1);
64 }
65 }
66 }
67
68 #[cfg(not(any(target_os = "windows", target_os = "linux", target_os = "macos")))]
69 {
70 println!("Native library not available on this platform.");
71 println!("Use the 'wasm' feature with a WASM runtime for BSD platforms.");
72 }
73}