-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
108 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,16 @@ | ||
use std::path::Path; | ||
|
||
fn main() { | ||
// add link dir for fabric support libs. This is propagated to downstream targets | ||
// let dir = String::from("build\\_deps\\fabric_metadata-build\\src"); | ||
// let package_root = env::var("CARGO_MANIFEST_DIR").unwrap(); | ||
// let abs_dir = package_root + &dir; | ||
// println!( | ||
// "cargo:rustc-link-search=native={}", | ||
// Path::new(&abs_dir).display() | ||
// ); | ||
|
||
// add link dir for fabric support libs. This is propagated to downstream targets | ||
if cfg!(unix) { | ||
// Add link dir for fabric libs on linux. | ||
let dir = String::from("/opt/microsoft/servicefabric/bin/Fabric/Fabric.Code/"); | ||
println!( | ||
"cargo:rustc-link-search={}", | ||
Path::new(&dir).display() | ||
); | ||
let dir2 = String::from("/workspaces/service-fabric-rs/bintemp"); | ||
println!( | ||
"cargo:rustc-link-search={}", | ||
Path::new(&dir2).display() | ||
); | ||
// println!("cargo:rustc-link-lib=dylib=FabricCommon"); | ||
// println!("cargo:rustc-link-lib=dylib=FabricResources"); | ||
// pal | ||
println!("cargo:rustc-link-lib=dylib=fabric_pal"); | ||
|
||
// On linux, for windows-rs to work we need have a pal shared lib. | ||
// No need to have search dir since it is in the target dir | ||
println!("cargo:rustc-link-lib=dylib=fabric_rust_pal"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[package] | ||
name = "pal" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
|
||
[lib] | ||
name = "fabric_rust_pal" | ||
path = "src/lib.rs" | ||
crate-type = ["cdylib"] | ||
|
||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies.windows] | ||
version = "0.43" | ||
features = [ | ||
"Win32_Foundation" | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#[allow( | ||
non_camel_case_types, | ||
non_snake_case, | ||
dead_code)] | ||
|
||
use std::ffi::c_void; | ||
|
||
use windows::core::{HRESULT, PCSTR, PWSTR}; | ||
|
||
|
||
#[no_mangle] | ||
pub unsafe extern "system" fn GetLastError() -> u32 { | ||
0 | ||
} | ||
|
||
#[no_mangle] | ||
pub unsafe extern "system" fn GetProcessHeap() -> isize{ | ||
0 | ||
} | ||
|
||
#[no_mangle] | ||
pub unsafe extern "system" fn HeapAlloc(_heap: isize, _flags: u32, _len: usize) -> *mut c_void{ | ||
std::ptr::null_mut() | ||
} | ||
|
||
#[no_mangle] | ||
pub unsafe extern "system" fn HeapFree(_heap: isize, _flags: u32, _ptr: *const c_void) -> i32{ | ||
0 | ||
} | ||
|
||
#[no_mangle] | ||
pub unsafe extern "system" fn GetErrorInfo(_reserved: u32, _info: *mut *mut c_void) -> HRESULT{ | ||
HRESULT(0) | ||
} | ||
|
||
#[no_mangle] | ||
pub unsafe extern "system" fn SetErrorInfo(_reserved: u32, _info: *const c_void) -> HRESULT{ | ||
HRESULT(0) | ||
} | ||
|
||
#[no_mangle] | ||
pub unsafe extern "system" fn LoadLibraryA(_name: PCSTR) -> isize{ | ||
0 | ||
} | ||
|
||
#[no_mangle] | ||
pub unsafe extern "system" fn FreeLibrary(_library: isize) -> i32{ | ||
0 | ||
} | ||
|
||
#[no_mangle] | ||
pub unsafe extern "system" fn GetProcAddress(_library: isize, _name: PCSTR) -> *const c_void{ | ||
std::ptr::null() | ||
} | ||
|
||
#[no_mangle] | ||
pub unsafe extern "system" fn SysFreeString(_bstr: *const u16){ | ||
|
||
} | ||
|
||
#[no_mangle] | ||
pub unsafe extern "system" fn SysStringLen(_bstr: *const u16) -> u32{ | ||
0 | ||
} | ||
|
||
#[no_mangle] | ||
pub unsafe extern "system" fn FormatMessageW(_flags: u32, _source: *const c_void, _code: u32, _lang: u32, _buffer: PWSTR, _len: u32, _args: *const *const i8) -> u32{ | ||
0 | ||
} |