-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Implement raw-dylib support for windows-gnu #90782
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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,23 @@ | ||
# Test the behavior of #[link(.., kind = "raw-dylib")], #[link_ordinal], and alternative calling conventions on i686 windows. | ||
|
||
# only-x86 | ||
# only-windows | ||
|
||
-include ../../run-make-fulldeps/tools.mk | ||
|
||
all: | ||
$(call COMPILE_OBJ,"$(TMPDIR)"/exporter.obj,exporter.c) | ||
ifdef IS_MSVC | ||
$(CC) "$(TMPDIR)"/exporter.obj exporter-msvc.def -link -dll -out:"$(TMPDIR)"/exporter.dll | ||
else | ||
$(CC) "$(TMPDIR)"/exporter.obj exporter-gnu.def -shared -o "$(TMPDIR)"/exporter.dll | ||
endif | ||
$(RUSTC) --crate-type lib --crate-name raw_dylib_test lib.rs | ||
$(RUSTC) --crate-type bin driver.rs -L "$(TMPDIR)" | ||
"$(TMPDIR)"/driver > "$(TMPDIR)"/actual_output.txt | ||
|
||
ifdef RUSTC_BLESS_TEST | ||
cp "$(TMPDIR)"/actual_output.txt expected_output.txt | ||
else | ||
$(DIFF) expected_output.txt "$(TMPDIR)"/actual_output.txt | ||
endif |
This file contains hidden or 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,5 @@ | ||
extern crate raw_dylib_test; | ||
|
||
fn main() { | ||
raw_dylib_test::library_function(); | ||
} |
2 changes: 2 additions & 0 deletions
2
src/test/run-make/raw-dylib-stdcall-ordinal/expected_output.txt
This file contains hidden or 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,2 @@ | ||
exported_function_stdcall(6) | ||
exported_function_fastcall(125) |
This file contains hidden or 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,4 @@ | ||
LIBRARY exporter | ||
EXPORTS | ||
exported_function_stdcall@4 @15 NONAME | ||
@exported_function_fastcall@4 @18 NONAME |
4 changes: 4 additions & 0 deletions
4
src/test/run-make/raw-dylib-stdcall-ordinal/exporter-msvc.def
This file contains hidden or 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,4 @@ | ||
LIBRARY exporter | ||
EXPORTS | ||
_exported_function_stdcall@4 @15 NONAME | ||
@exported_function_fastcall@4 @18 NONAME |
This file contains hidden or 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,11 @@ | ||
#include <stdio.h> | ||
|
||
void __stdcall exported_function_stdcall(int i) { | ||
printf("exported_function_stdcall(%d)\n", i); | ||
fflush(stdout); | ||
} | ||
|
||
void __fastcall exported_function_fastcall(int i) { | ||
printf("exported_function_fastcall(%d)\n", i); | ||
fflush(stdout); | ||
} |
This file contains hidden or 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,20 @@ | ||
#![feature(raw_dylib)] | ||
|
||
#[link(name = "exporter", kind = "raw-dylib")] | ||
extern "stdcall" { | ||
#[link_ordinal(15)] | ||
fn imported_function_stdcall(i: i32); | ||
michaelwoerister marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
#[link(name = "exporter", kind = "raw-dylib")] | ||
extern "fastcall" { | ||
#[link_ordinal(18)] | ||
fn imported_function_fastcall(i: i32); | ||
} | ||
|
||
pub fn library_function() { | ||
unsafe { | ||
imported_function_stdcall(6); | ||
imported_function_fastcall(125); | ||
} | ||
} |
8 changes: 0 additions & 8 deletions
8
src/test/ui/feature-gates/feature-gate-raw-dylib-windows-gnu.rs
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.