mirror of
https://github.com/Noratrieb/portability.git
synced 2026-01-14 15:55:04 +01:00
fixes
This commit is contained in:
parent
091e833acf
commit
dc6ef2108d
17 changed files with 221 additions and 39 deletions
16
test2/Makefile
Normal file
16
test2/Makefile
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
RUSTC = rustc --target x86_64-pc-windows-msvc -Cpanic=abort -Clinker=lld-link -Clink-arg=/NODEFAULTLIB -Clink-arg=/debug:none -Cdebuginfo=0
|
||||
|
||||
build: empty_exe.exe one_dll.exe
|
||||
|
||||
empty_exe.exe: empty_exe.rs
|
||||
$(RUSTC) empty_exe.rs
|
||||
|
||||
one_dll.exe: one_dll.rs small_dll.dll
|
||||
$(RUSTC) one_dll.rs
|
||||
|
||||
small_dll.dll: small_dll.rs
|
||||
$(RUSTC) small_dll.rs
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm *.exe *.pdb *.dll
|
||||
13
test2/empty_exe.rs
Normal file
13
test2/empty_exe.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
#![no_std]
|
||||
#![no_main]
|
||||
#![windows_subsystem = "console"]
|
||||
|
||||
#[panic_handler]
|
||||
fn handle_panic(_: &core::panic::PanicInfo<'_>) -> ! {
|
||||
loop {}
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "stdcall" fn mainCRTStartup() -> u32 {
|
||||
42
|
||||
}
|
||||
18
test2/one_dll.rs
Normal file
18
test2/one_dll.rs
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
#![no_std]
|
||||
#![no_main]
|
||||
#![windows_subsystem = "console"]
|
||||
|
||||
#[link(name = "small_dll", kind = "raw-dylib")]
|
||||
unsafe extern "C" {
|
||||
safe fn my_export() -> u32;
|
||||
}
|
||||
|
||||
#[panic_handler]
|
||||
fn handle_panic(_: &core::panic::PanicInfo<'_>) -> ! {
|
||||
loop {}
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "stdcall" fn mainCRTStartup() -> u32 {
|
||||
my_export()
|
||||
}
|
||||
18
test2/small_dll.rs
Normal file
18
test2/small_dll.rs
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
#![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() -> u32 {
|
||||
42
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "stdcall" fn _DllMainCRTStartup() -> u32 {
|
||||
0
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue