Fix build on Linux

This commit is contained in:
Wojtek Figat
2023-01-04 19:00:06 +01:00
parent ccd919d4d6
commit 63d3c9b1e0
13 changed files with 58 additions and 33 deletions

View File

@@ -1,6 +1,7 @@
// Copyright (c) 2012-2022 Wojciech Figat. All rights reserved.
#include "CoreCLR.h"
#if USE_NETCORE
#include "Engine/Core/Log.h"
#include "Engine/Platform/Platform.h"
#include "Engine/Platform/FileSystem.h"
@@ -130,3 +131,5 @@ void CoreCLR::Free(void* ptr)
{
Platform::Free(ptr);
}
#endif

View File

@@ -6,6 +6,8 @@
#include "Engine/Core/Collections/Array.h"
#include "Engine/Scripting/Types.h"
#if USE_NETCORE
#if defined(_WIN32)
#define CORECLR_DELEGATE_CALLTYPE __stdcall
#define FLAX_CORECLR_STRING String
@@ -59,5 +61,7 @@ public:
static bool HasCustomAttribute(void* klass, void* attribClass);
static bool HasCustomAttribute(void* klass);
static void* GetCustomAttribute(void* klass, void* attribClass);
static Array<void*> GetCustomAttributes(void* klass);
static Array<MObject*> GetCustomAttributes(void* klass);
};
#endif

View File

@@ -1,6 +1,7 @@
// Copyright (c) 2012-2022 Wojciech Figat. All rights reserved.
#include "CoreCLR.h"
#if USE_NETCORE
#include "Engine/Scripting/Types.h"
#include "Engine/Core/Collections/Dictionary.h"
#include "Engine/Graphics/RenderView.h"
@@ -614,24 +615,25 @@ bool CoreCLR::HasCustomAttribute(void* klass, void* attribClass)
{
return CoreCLR::GetCustomAttribute(klass, attribClass) != nullptr;
}
bool CoreCLR::HasCustomAttribute(void* klass)
{
return CoreCLR::GetCustomAttribute(klass, nullptr) != nullptr;
}
void* CoreCLR::GetCustomAttribute(void* klass, void* attribClass)
{
static void* GetCustomAttributePtr = CoreCLR::GetStaticMethodPointer(TEXT("GetCustomAttribute"));
return CoreCLR::CallStaticMethod<void*, void*, void*>(GetCustomAttributePtr, ((CoreCLRClass*)klass)->GetTypeHandle(), ((CoreCLRClass*)attribClass)->GetTypeHandle());
}
Array<void*> CoreCLR::GetCustomAttributes(void* klass)
Array<MObject*> CoreCLR::GetCustomAttributes(void* klass)
{
Array<CoreCLRCustomAttribute*> attribs = ((CoreCLRClass*)klass)->GetCustomAttributes();
Array<void*> attributes;
const Array<CoreCLRCustomAttribute*>& attribs = ((CoreCLRClass*)klass)->GetCustomAttributes();
Array<MObject*> attributes;
attributes.Resize(attribs.Count(), false);
for (int i = 0; i < attribs.Count(); i++)
attributes.Add(attribs[i]->GetHandle());
for (int32 i = 0; i < attribs.Count(); i++)
attributes.Add((MObject*)attribs[i]->GetHandle());
return attributes;
}
@@ -1616,3 +1618,5 @@ MONO_API void mono_gc_finalize_notify(void)
}
#pragma warning(default : 4297)
#endif