40 lines
1.4 KiB
C++
40 lines
1.4 KiB
C++
#include "RuntimeApi.h"
|
|
|
|
#include "codegen/il2cpp-codegen.h"
|
|
#include "vm/InternalCalls.h"
|
|
#include "vm/Array.h"
|
|
#include "vm/Exception.h"
|
|
|
|
#include "metadata/MetadataModule.h"
|
|
#include "RuntimeConfig.h"
|
|
|
|
namespace hybridclr
|
|
{
|
|
void RuntimeApi::RegisterInternalCalls()
|
|
{
|
|
il2cpp::vm::InternalCalls::Add("HybridCLR.RuntimeApi::LoadMetadataForAOTAssembly(System.Byte[],HybridCLR.HomologousImageMode)", (Il2CppMethodPointer)LoadMetadataForAOTAssembly);
|
|
il2cpp::vm::InternalCalls::Add("HybridCLR.RuntimeApi::GetRuntimeOption(HybridCLR.RuntimeOptionId)", (Il2CppMethodPointer)GetRuntimeOption);
|
|
il2cpp::vm::InternalCalls::Add("HybridCLR.RuntimeApi::SetRuntimeOption(HybridCLR.RuntimeOptionId,System.Int32)", (Il2CppMethodPointer)SetRuntimeOption);
|
|
}
|
|
|
|
int32_t RuntimeApi::LoadMetadataForAOTAssembly(Il2CppArray* dllBytes, int32_t mode)
|
|
{
|
|
if (!dllBytes)
|
|
{
|
|
il2cpp::vm::Exception::RaiseNullReferenceException();
|
|
}
|
|
return (int32_t)hybridclr::metadata::MetadataModule::LoadMetadataForAOTAssembly(il2cpp::vm::Array::GetFirstElementAddress(dllBytes), il2cpp::vm::Array::GetByteLength(dllBytes), (hybridclr::metadata::HomologousImageMode)mode);
|
|
}
|
|
|
|
int32_t RuntimeApi::GetRuntimeOption(int32_t optionId)
|
|
{
|
|
return hybridclr::RuntimeConfig::GetRuntimeOption((hybridclr::RuntimeOptionId)optionId);
|
|
}
|
|
|
|
void RuntimeApi::SetRuntimeOption(int32_t optionId, int32_t value)
|
|
{
|
|
hybridclr::RuntimeConfig::SetRuntimeOption((hybridclr::RuntimeOptionId)optionId, value);
|
|
}
|
|
|
|
}
|