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

@@ -336,7 +336,6 @@ const Array<MProperty*>& MClass::GetProperties()
{
if (_hasCachedProperties)
return _properties;
#if USE_MONO
void* iter = nullptr;
MonoProperty* curClassProperty;
@@ -346,7 +345,6 @@ const Array<MProperty*>& MClass::GetProperties()
GetProperty(propertyName);
}
#endif
_hasCachedProperties = true;
return _properties;
}
@@ -416,10 +414,9 @@ const Array<MObject*>& MClass::GetAttributes()
{
if (_hasCachedAttributes)
return _attributes;
_hasCachedAttributes = true;
#if USE_NETCORE
_attributes = *(Array<MObject*>*)(&CoreCLR::GetCustomAttributes(_monoClass));
_attributes = MoveTemp(CoreCLR::GetCustomAttributes(_monoClass));
#elif USE_MONO
MonoCustomAttrInfo* attrInfo = GET_CUSTOM_ATTR();
if (attrInfo == nullptr)

View File

@@ -16,10 +16,11 @@
#if USE_NETCORE
#include "Engine/Scripting/DotNet/CoreCLR.h"
#include "Engine/Core/Collections/BitArray.h"
#endif
struct Version;
template<typename AllocationType>
class BitArray;
namespace MUtils
{
@@ -612,13 +613,25 @@ namespace MUtils
/// </summary>
/// <param name="data">The input data.</param>
/// <returns>The output array.</returns>
FORCE_INLINE bool* ToBoolArray(const BitArray<>& data)
template<typename AllocationType = HeapAllocation>
FORCE_INLINE bool* ToBoolArray(const BitArray<AllocationType>& data)
{
bool* arr = (bool*)CoreCLR::Allocate(data.Count() * sizeof(bool));
for (int i = 0; i < data.Count(); i++)
arr[i] = data[i];
return arr;
}
#else
FORCE_INLINE bool* ToBoolArray(const Array<bool>& data)
{
return nullptr;
}
template<typename AllocationType = HeapAllocation>
FORCE_INLINE bool* ToBoolArray(const BitArray<AllocationType>& data)
{
return nullptr;
}
#endif
FORCE_INLINE MGCHandle NewGCHandle(MonoObject* obj, bool pinned)
@@ -635,7 +648,7 @@ namespace MUtils
#if USE_NETCORE
return CoreCLR::NewGCHandleWeakref(obj, track_resurrection);
#else
return mono_gchandle_new_weak_ref(obj, track_resurrection);
return mono_gchandle_new_weakref(obj, track_resurrection);
#endif
}