File tree 4 files changed +12
-12
lines changed
4 files changed +12
-12
lines changed Original file line number Diff line number Diff line change 18
18
- target : aarch64-apple-darwin
19
19
os : macos-latest
20
20
21
- # TODO
22
- # - target: x86_64-pc-windows-msvc
23
- # os: windows-latest
21
+ - target : x86_64-pc-windows-gnu
22
+ os : windows-latest
24
23
25
24
steps :
26
25
- uses : actions/checkout@v4
Original file line number Diff line number Diff line change @@ -35,6 +35,5 @@ fn main() -> Result<()> {
35
35
## TODO
36
36
37
37
- NULL value
38
- - Windows support
39
38
- Dynamic link crossdb
40
39
- use serde to serialize/deserialize
Original file line number Diff line number Diff line change 1
- use std:: env;
1
+ use std:: env:: var ;
2
2
use std:: path:: PathBuf ;
3
3
4
4
fn main ( ) {
5
- let out_path = PathBuf :: from ( env :: var ( "OUT_DIR" ) . unwrap ( ) ) ;
5
+ let out = PathBuf :: from ( var ( "OUT_DIR" ) . unwrap ( ) ) ;
6
6
bindgen:: builder ( )
7
7
. header ( "crossdb/include/crossdb.h" )
8
8
. parse_callbacks ( Box :: new ( bindgen:: CargoCallbacks :: new ( ) ) )
9
9
. generate ( )
10
10
. unwrap ( )
11
- . write_to_file ( out_path . join ( "./bindings.rs" ) )
11
+ . write_to_file ( out . join ( "./bindings.rs" ) )
12
12
. unwrap ( ) ;
13
13
14
14
let mut builder = cc:: Build :: new ( ) ;
15
15
builder
16
16
. file ( "crossdb/src/crossdb.c" )
17
17
. include ( "crossdb/include" )
18
- . flag ( "-fPIC " )
18
+ . flag ( "-lpthread " )
19
19
. opt_level ( 2 )
20
20
. static_flag ( true ) ;
21
21
22
22
// TODO: Potentially unsafe
23
23
builder. cargo_warnings ( false ) ;
24
24
25
- builder. compile ( "crossdb" ) ;
25
+ #[ cfg( target_os = "windows" ) ]
26
+ {
27
+ builder. flag ( "-lws2_32" ) . compiler ( "gcc" ) ;
28
+ }
26
29
30
+ builder. compile ( "crossdb" ) ;
27
31
println ! ( "cargo:rustc-link-lib=static=crossdb" ) ;
28
- println ! ( "cargo:rustc-link-lib=pthread" ) ;
29
-
30
32
println ! ( "cargo:rerun-if-changed=crossdb/" ) ;
31
33
}
Original file line number Diff line number Diff line change @@ -123,7 +123,7 @@ unsafe impl Sync for Query {}
123
123
impl Query {
124
124
pub ( crate ) unsafe fn from_res ( ptr : * mut xdb_res_t ) -> Result < Self > {
125
125
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 {
127
127
let msg = CStr :: from_ptr ( xdb_errmsg ( ptr) ) . to_str ( ) ?. to_string ( ) ;
128
128
return Err ( Error :: Query ( res. errcode , msg) ) ;
129
129
}
You can’t perform that action at this time.
0 commit comments