mirror of
https://github.com/Noratrieb/portability.git
synced 2026-01-14 15:55:04 +01:00
STUFF
This commit is contained in:
parent
cec97ff44d
commit
64c30e201d
11 changed files with 4426 additions and 213 deletions
|
|
@ -1,7 +1,7 @@
|
|||
SHELL = bash
|
||||
RUSTC = rustc --target x86_64-pc-windows-msvc -Cpanic=abort -Clinker=lld-link -Clink-arg=/NODEFAULTLIB -Clink-arg=/debug:none -Cdebuginfo=0
|
||||
RUSTC = rustc --target x86_64-pc-windows-msvc -Copt-level=3 -Cpanic=abort -Clinker=lld-link -Clink-arg=/NODEFAULTLIB -Clink-arg=/debug:none -Cdebuginfo=0
|
||||
|
||||
build: empty_exe.exe one_dll.exe
|
||||
build: empty_exe.exe one_dll.exe two_dll.exe
|
||||
|
||||
empty_exe.exe: empty_exe.rs
|
||||
$(RUSTC) empty_exe.rs
|
||||
|
|
@ -12,6 +12,12 @@ one_dll.exe: one_dll.rs small_dll.dll
|
|||
small_dll.dll: small_dll.rs
|
||||
$(RUSTC) small_dll.rs
|
||||
|
||||
ordinal_dll.dll: ordinal_dll.rs ordinal_dll.def
|
||||
$(RUSTC) -Clink-arg=/def:ordinal_dll.def ordinal_dll.rs
|
||||
|
||||
two_dll.exe: small_dll.dll ordinal_dll.dll
|
||||
$(RUSTC) two_dll.rs
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
shopt -s nullglob
|
||||
|
|
|
|||
4
test2/ordinal_dll.def
Normal file
4
test2/ordinal_dll.def
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
EXPORTS
|
||||
my_export_ordinal_1 @1
|
||||
my_export_ordinal_2 @2
|
||||
my_export_named
|
||||
28
test2/ordinal_dll.rs
Normal file
28
test2/ordinal_dll.rs
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
#![no_std]
|
||||
#![crate_type = "cdylib"]
|
||||
#![windows_subsystem = "console"]
|
||||
|
||||
#[panic_handler]
|
||||
fn handle_panic(_: &core::panic::PanicInfo<'_>) -> ! {
|
||||
loop {}
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn my_export_ordinal_1() -> u32 {
|
||||
1
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn my_export_ordinal_2() -> u32 {
|
||||
2
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn my_export_named() -> u32 {
|
||||
5
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "stdcall" fn _DllMainCRTStartup() -> u32 {
|
||||
0
|
||||
}
|
||||
30
test2/two_dll.rs
Normal file
30
test2/two_dll.rs
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
#![no_std]
|
||||
#![no_main]
|
||||
#![windows_subsystem = "console"]
|
||||
|
||||
#[link(name = "small_dll", kind = "raw-dylib")]
|
||||
unsafe extern "C" {
|
||||
safe fn my_export() -> u32;
|
||||
}
|
||||
|
||||
#[link(name = "ordinal_dll", kind = "raw-dylib")]
|
||||
unsafe extern "C" {
|
||||
#[link_ordinal(1)]
|
||||
safe fn my_export_ordinal_1() -> u32;
|
||||
#[link_ordinal(2)]
|
||||
safe fn my_export_ordinal_2() -> u32;
|
||||
safe fn my_export_named() -> u32;
|
||||
}
|
||||
|
||||
#[panic_handler]
|
||||
fn handle_panic(_: &core::panic::PanicInfo<'_>) -> ! {
|
||||
loop {}
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "stdcall" fn mainCRTStartup() -> u32 {
|
||||
my_export()
|
||||
.wrapping_add(my_export_ordinal_1())
|
||||
.wrapping_add(my_export_ordinal_2())
|
||||
.wrapping_add(my_export_named())
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue