File tree Expand file tree Collapse file tree 4 files changed +12
-12
lines changed Expand file tree Collapse file tree 4 files changed +12
-12
lines changed Original file line number Diff line number Diff line change 1818 - target : aarch64-apple-darwin
1919 os : macos-latest
2020
21- # TODO
22- # - target: x86_64-pc-windows-msvc
23- # os: windows-latest
21+ - target : x86_64-pc-windows-gnu
22+ os : windows-latest
2423
2524 steps :
2625 - uses : actions/checkout@v4
Original file line number Diff line number Diff line change @@ -35,6 +35,5 @@ fn main() -> Result<()> {
3535## TODO
3636
3737- NULL value
38- - Windows support
3938- Dynamic link crossdb
4039- use serde to serialize/deserialize
Original file line number Diff line number Diff line change 1- use std:: env;
1+ use std:: env:: var ;
22use std:: path:: PathBuf ;
33
44fn main ( ) {
5- let out_path = PathBuf :: from ( env :: var ( "OUT_DIR" ) . unwrap ( ) ) ;
5+ let out = PathBuf :: from ( var ( "OUT_DIR" ) . unwrap ( ) ) ;
66 bindgen:: builder ( )
77 . header ( "crossdb/include/crossdb.h" )
88 . parse_callbacks ( Box :: new ( bindgen:: CargoCallbacks :: new ( ) ) )
99 . generate ( )
1010 . unwrap ( )
11- . write_to_file ( out_path . join ( "./bindings.rs" ) )
11+ . write_to_file ( out . join ( "./bindings.rs" ) )
1212 . unwrap ( ) ;
1313
1414 let mut builder = cc:: Build :: new ( ) ;
1515 builder
1616 . file ( "crossdb/src/crossdb.c" )
1717 . include ( "crossdb/include" )
18- . flag ( "-fPIC " )
18+ . flag ( "-lpthread " )
1919 . opt_level ( 2 )
2020 . static_flag ( true ) ;
2121
2222 // TODO: Potentially unsafe
2323 builder. cargo_warnings ( false ) ;
2424
25- builder. compile ( "crossdb" ) ;
25+ #[ cfg( target_os = "windows" ) ]
26+ {
27+ builder. flag ( "-lws2_32" ) . compiler ( "gcc" ) ;
28+ }
2629
30+ builder. compile ( "crossdb" ) ;
2731 println ! ( "cargo:rustc-link-lib=static=crossdb" ) ;
28- println ! ( "cargo:rustc-link-lib=pthread" ) ;
29-
3032 println ! ( "cargo:rerun-if-changed=crossdb/" ) ;
3133}
Original file line number Diff line number Diff line change @@ -123,7 +123,7 @@ unsafe impl Sync for Query {}
123123impl Query {
124124 pub ( crate ) unsafe fn from_res ( ptr : * mut xdb_res_t ) -> Result < Self > {
125125 let res = * ptr;
126- if res. errcode as u32 != xdb_errno_e_XDB_OK {
126+ if res. errcode != xdb_errno_e_XDB_OK as u16 {
127127 let msg = CStr :: from_ptr ( xdb_errmsg ( ptr) ) . to_str ( ) ?. to_string ( ) ;
128128 return Err ( Error :: Query ( res. errcode , msg) ) ;
129129 }
You can’t perform that action at this time.
0 commit comments