Skip to content

[Mono] Add coreclr_shutdown to mono #88594

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 2 commits into from
Jul 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/mono/mono/mini/main-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#pragma comment(linker, "/export:coreclr_initialize=_coreclr_initialize@28")
#pragma comment(linker, "/export:coreclr_execute_assembly=_coreclr_execute_assembly@24")
#pragma comment(linker, "/export:coreclr_shutdown_2=_coreclr_shutdown_2@12")
#pragma comment(linker, "/export:coreclr_shutdown=_coreclr_shutdown@8")
#pragma comment(linker, "/export:coreclr_create_delegate=_coreclr_create_delegate@24")
#pragma comment(linker, "/export:coreclr_set_error_writer=_coreclr_set_error_writer@4")
#undef MONO_API
Expand All @@ -39,6 +40,7 @@ MONO_API int STDAPICALLTYPE coreclr_execute_assembly (void* hostHandle, unsigned
const char* managedAssemblyPath, unsigned int* exitCode);

MONO_API int STDAPICALLTYPE coreclr_shutdown_2 (void* hostHandle, unsigned int domainId, int* latchedExitCode);
MONO_API int STDAPICALLTYPE coreclr_shutdown (void* hostHandle, unsigned int domainId);

MONO_API int STDAPICALLTYPE coreclr_create_delegate (void* hostHandle, unsigned int domainId,
const char* entryPointAssemblyName, const char* entryPointTypeName, const char* entryPointMethodName,
Expand Down Expand Up @@ -105,6 +107,24 @@ int STDAPICALLTYPE coreclr_shutdown_2 (void* hostHandle, unsigned int domainId,
return monovm_shutdown (latchedExitCode);
}

//
// Shutdown CoreCLR. It unloads the app domain and stops the CoreCLR host.
//
// Parameters:
// hostHandle - Handle of the host
// domainId - Id of the domain
// latchedExitCode - Latched exit code after domain unloaded
//
// Returns:
// HRESULT indicating status of the operation. S_OK if the assembly was successfully executed
//
int STDAPICALLTYPE coreclr_shutdown (void* hostHandle, unsigned int domainId)
{
int latchedExitCode = 0 ;
return monovm_shutdown (&latchedExitCode);
}


//
// Create a native callable delegate for a managed method.
//
Expand Down