1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 20:42:21 +02:00

Sized-array calling convention fix

This commit is contained in:
Brian Fiete 2020-12-28 06:42:18 -08:00
parent 80fcf84de2
commit 8a63a7ed80
5 changed files with 17 additions and 5 deletions

View file

@ -534,6 +534,11 @@ extern "C" Interop::StructJ Func4J(Interop::StructJ arg0, Interop::StructJ arg1,
return ret;
}
extern "C" double Func5(float v0[2], float v1[3])
{
return v0[0] + v0[1]*10 + v1[0]*100 + v1[1]*1000 + v1[2]*10000;
}
void UseIt()
{
Interop::StructA sa;

View file

@ -308,6 +308,9 @@ namespace Tests
[LinkName(.C)]
public static extern StructJ Func4J(StructJ arg0, StructJ arg1, StructJ arg2, StructJ arg3);
[LinkName(.C)]
public static extern double Func5(float[2] v0, float[3] v1);
static int32 LocalFunc0K(int32 a, StructK b) => a + (int32)b.mX * 100 + (int32)b.mY * 10000;
static int32 LocalFunc0L(int32 a, StructL b) => a + (int32)b.mX * 100 + (int32)b.mY * 10000;
static int32 LocalFunc0M(int32 a, StructM b) => a + (int32)b.mX * 100 + (int32)b.mY * 10000;
@ -517,6 +520,9 @@ namespace Tests
sj3.mLength = 6;
var sjRet = Func4J(sj0, sj1, sj2, sj3);
Test.Assert(sjRet.mLength == 6050403);
var val5 = Func5(.(1, 2), .(3, 4, 5));
Test.Assert(Math.Round(val5) == 54321);
}
}
}