File tree 3 files changed +82
-0
lines changed
3 files changed +82
-0
lines changed Original file line number Diff line number Diff line change @@ -1217,6 +1217,27 @@ public void TestHasFixedArrayOfPointers()
1217
1217
}
1218
1218
}
1219
1219
1220
+ [ Test ]
1221
+ public void TestVirtualIndirectCallInNative ( )
1222
+ {
1223
+ using ( Inter i = new Inter ( ) )
1224
+ {
1225
+ using ( InterfaceTester tester = new InterfaceTester ( ) )
1226
+ {
1227
+ tester . SetInterface ( i ) ;
1228
+ Assert . That ( tester . Get ( 10 ) , Is . EqualTo ( IntPtr . Zero ) ) ;
1229
+ }
1230
+ }
1231
+ }
1232
+
1233
+ public class Inter : SimpleInterface
1234
+ {
1235
+ public override int Size => s ;
1236
+ public override int Capacity => s ;
1237
+ public override IntPtr Get ( int n ) { return new IntPtr ( 0 ) ; }
1238
+ private int s = 0 ;
1239
+ }
1240
+
1220
1241
private class OverrideVirtualTemplate : VirtualTemplate < int >
1221
1242
{
1222
1243
public override int Function
Original file line number Diff line number Diff line change @@ -1495,3 +1495,39 @@ HasFixedArrayOfPointers::HasFixedArrayOfPointers()
1495
1495
HasFixedArrayOfPointers::~HasFixedArrayOfPointers ()
1496
1496
{
1497
1497
}
1498
+
1499
+ SimpleInterface::SimpleInterface ()
1500
+ {
1501
+ }
1502
+
1503
+ SimpleInterface::~SimpleInterface ()
1504
+ {
1505
+ }
1506
+
1507
+ InterfaceTester::InterfaceTester () : interface(0 )
1508
+ {
1509
+ }
1510
+
1511
+ InterfaceTester::~InterfaceTester ()
1512
+ {
1513
+ }
1514
+
1515
+ int InterfaceTester::capacity ()
1516
+ {
1517
+ return interface->capacity ();
1518
+ }
1519
+
1520
+ int InterfaceTester::size ()
1521
+ {
1522
+ return interface->size ();
1523
+ }
1524
+
1525
+ void * InterfaceTester::get (int n)
1526
+ {
1527
+ return interface->get (n);
1528
+ }
1529
+
1530
+ void InterfaceTester::setInterface (SimpleInterface* i)
1531
+ {
1532
+ interface = i;
1533
+ }
Original file line number Diff line number Diff line change @@ -1262,3 +1262,28 @@ struct DLL_API CSharp
1262
1262
};
1263
1263
1264
1264
static int FOOBAR_CONSTANT = 42 ;
1265
+
1266
+
1267
+
1268
+ class DLL_API SimpleInterface
1269
+ {
1270
+ public:
1271
+ SimpleInterface ();
1272
+ ~SimpleInterface ();
1273
+ virtual int size () const = 0;
1274
+ virtual int capacity () const = 0;
1275
+ virtual void * get (int n) = 0;
1276
+ };
1277
+
1278
+ class DLL_API InterfaceTester
1279
+ {
1280
+ public:
1281
+ InterfaceTester ();
1282
+ ~InterfaceTester ();
1283
+ int capacity ();
1284
+ int size ();
1285
+ void * get (int n);
1286
+ void setInterface (SimpleInterface* i);
1287
+ private:
1288
+ SimpleInterface* interface;
1289
+ };
You can’t perform that action at this time.
0 commit comments