-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
[mono] Export unmanagedcallersonly method symbols #79424
Merged
mdh1418
merged 6 commits into
dotnet:main
from
mdh1418:export_unmanagedcallersonly_method_symbols
Dec 19, 2022
Merged
[mono] Export unmanagedcallersonly method symbols #79424
mdh1418
merged 6 commits into
dotnet:main
from
mdh1418:export_unmanagedcallersonly_method_symbols
Dec 19, 2022
Conversation
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
[mono] Export EntryPoint of methods decorated with UnmanagedCallersOnlyAttribute to specified export_symbols_outfile
mdh1418
commented
Dec 9, 2022
mdh1418
commented
Dec 9, 2022
mdh1418
force-pushed
the
export_unmanagedcallersonly_method_symbols
branch
from
December 9, 2022 05:11
581dde9
to
18dffe1
Compare
mdh1418
requested review from
lateralusX,
steveisok,
ivanpovazan,
lambdageek and
akoeplinger
December 9, 2022 05:34
vargaz
reviewed
Dec 9, 2022
lateralusX
reviewed
Dec 9, 2022
lateralusX
reviewed
Dec 9, 2022
lateralusX
reviewed
Dec 9, 2022
lateralusX
reviewed
Dec 9, 2022
This was referenced Dec 9, 2022
lateralusX
approved these changes
Dec 19, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
The failure is known #79439 |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Contributes to #79377
Native developers want to be able to call managed functions from their native applications using a shared library with the mono runtime. In order for this to happen, symbols corresponding to the managed functions need to be known while linking together the shared library. Typically, such methods are marked with UnmanagedCallersOnly Attribute, and the expectation is that the developers will designate an
EntryPoint
field corresponding to the desired function on the native side. (e.g.[UnmanagedCallersOnly(EntryPoint = "<native_function/symbol>"]
)In order to build the shared library, a list of symbols corresponding to the methods decorated with such attributes exemplified above need to be generated while compiling each assembly, and consumed when building the shared library.
This PR targets the first part by generating for each assembly an
.exportsymbols
file which is a plain text file containing each EntryPoint symbol on its own line if and only if there is a positive number of such EntryPoint symbols.Specifically, this PR:
<assembly>.exportsymbols
in the MonoAOTCompiler Task when in full aot mode and when theEnableUnmanagedCallersOnlyMethodsExport
flag is on.UnmanagedCallersOnly
attribute containing anEntryPoint
corresponding to the desired native function, where each symbol is formatted based on the target platform.