mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 11:38:21 +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<void*> ffiArgList = scope .(16);
|
||||
List<Variant> tempVariants = scope .(4);
|
||||
List<Variant*> tempVariants = scope .(4);
|
||||
defer
|
||||
{
|
||||
for (var variant in tempVariants)
|
||||
variant.Dispose();
|
||||
}
|
||||
|
||||
var target;
|
||||
|
||||
|
@ -761,15 +766,17 @@ namespace System.Reflection
|
|||
|
||||
if (underlyingType == paramType)
|
||||
handled = true;
|
||||
|
||||
|
||||
if (!handled)
|
||||
{
|
||||
if (!underlyingType.IsSubtypeOf(paramType))
|
||||
{
|
||||
if (Convert.ConvertTo(arg, paramType) case .Ok(var variant))
|
||||
{
|
||||
tempVariants.Add(variant);
|
||||
dataPtr = variant.GetValueData();
|
||||
var tempVariant = scope:mixin Variant();
|
||||
*tempVariant = variant;
|
||||
tempVariants.Add(tempVariant);
|
||||
dataPtr = tempVariant.GetValueData();
|
||||
}
|
||||
else
|
||||
isValid = false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue