mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 04:22:20 +02:00
FFI invocation fix where data conversion is required
This commit is contained in:
parent
db0af3a8e5
commit
5e2f036918
1 changed files with 11 additions and 4 deletions
|
@ -610,7 +610,12 @@ namespace System.Reflection
|
||||||
|
|
||||||
List<FFIType*> ffiParamList = scope .(16);
|
List<FFIType*> ffiParamList = scope .(16);
|
||||||
List<void*> ffiArgList = scope .(16);
|
List<void*> ffiArgList = scope .(16);
|
||||||
List<Variant> tempVariants = scope .(4);
|
List<Variant*> tempVariants = scope .(4);
|
||||||
|
defer
|
||||||
|
{
|
||||||
|
for (var variant in tempVariants)
|
||||||
|
variant.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
var target;
|
var target;
|
||||||
|
|
||||||
|
@ -761,15 +766,17 @@ namespace System.Reflection
|
||||||
|
|
||||||
if (underlyingType == paramType)
|
if (underlyingType == paramType)
|
||||||
handled = true;
|
handled = true;
|
||||||
|
|
||||||
if (!handled)
|
if (!handled)
|
||||||
{
|
{
|
||||||
if (!underlyingType.IsSubtypeOf(paramType))
|
if (!underlyingType.IsSubtypeOf(paramType))
|
||||||
{
|
{
|
||||||
if (Convert.ConvertTo(arg, paramType) case .Ok(var variant))
|
if (Convert.ConvertTo(arg, paramType) case .Ok(var variant))
|
||||||
{
|
{
|
||||||
tempVariants.Add(variant);
|
var tempVariant = scope:mixin Variant();
|
||||||
dataPtr = variant.GetValueData();
|
*tempVariant = variant;
|
||||||
|
tempVariants.Add(tempVariant);
|
||||||
|
dataPtr = tempVariant.GetValueData();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
isValid = false;
|
isValid = false;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue