1// Licensed to the .NET Foundation under one or more agreements.
2// The .NET Foundation licenses this file to you under the MIT license.
3// See the LICENSE file in the project root for more information.
4
5#include <xplatform.h>
6#include <platformdefines.h>
7const int ARRAY_SIZE = 100;
8template<typename T> bool IsObjectEquals(T o1, T o2);
9
10/*----------------------------------------------------------------------------
11macro definition
12----------------------------------------------------------------------------*/
13
14#define ENTERFUNC() printf("========== [%s]\t ==========\n", __FUNCTION__)
15
16#define CHECK_PARAM_NOT_EMPTY(__p) \
17 ENTERFUNC(); \
18 if ( (__p) == NULL ) \
19{ \
20 printf("[%s] Error: parameter actual is NULL\n", __FUNCTION__); \
21 return false; \
22} \
23 else
24
25#define INIT_EXPECTED(__type, __size) \
26 __type expected[(__size)]; \
27 for ( size_t i = 0; i < (__size); ++i) \
28 expected[i] = (__type)i
29
30#define INIT_EXPECTED_STRUCT(__type, __size, __array_type) \
31 __type *expected = (__type *)CoreClrAlloc( sizeof(__type) ); \
32 for ( size_t i = 0; i < (__size); ++i) \
33 expected->arr[i] = (__array_type)i
34
35#define EQUALS(__actual, __cActual, __expected) Equals((__actual), (__cActual), (__expected), (int)sizeof(__expected) / sizeof(__expected[0]))
36
37/*----------------------------------------------------------------------------
38struct definition
39----------------------------------------------------------------------------*/
40
41typedef struct { INT arr[ARRAY_SIZE]; } S_INTArray;
42typedef struct { UINT arr[ARRAY_SIZE]; } S_UINTArray;
43typedef struct { SHORT arr[ARRAY_SIZE]; } S_SHORTArray;
44typedef struct { WORD arr[ARRAY_SIZE]; } S_WORDArray;
45typedef struct { LONG64 arr[ARRAY_SIZE]; } S_LONG64Array;
46
47typedef struct { ULONG64 arr[ARRAY_SIZE]; } S_ULONG64Array;
48typedef struct { DOUBLE arr[ARRAY_SIZE]; } S_DOUBLEArray;
49typedef struct { FLOAT arr[ARRAY_SIZE]; } S_FLOATArray;
50typedef struct { BYTE arr[ARRAY_SIZE]; } S_BYTEArray;
51typedef struct { CHAR arr[ARRAY_SIZE]; } S_CHARArray;
52
53typedef struct { DWORD_PTR arr[ARRAY_SIZE]; } S_DWORD_PTRArray;
54
55typedef struct { LPSTR arr[ARRAY_SIZE]; } S_LPSTRArray;
56typedef struct { LPCSTR arr[ARRAY_SIZE]; } S_LPCSTRArray;
57
58//struct array in a struct
59typedef struct { INT x; DOUBLE d;
60LONG64 l; LPSTR str; } TestStruct;
61
62typedef struct { TestStruct arr[ARRAY_SIZE]; } S_StructArray;
63
64typedef struct { BOOL arr[ARRAY_SIZE]; } S_BOOLArray;
65
66/*----------------------------------------------------------------------------
67helper function
68----------------------------------------------------------------------------*/
69
70
71LPSTR ToString(int i)
72{
73 CHAR *pBuffer = (CHAR *)CoreClrAlloc(10 * sizeof(CHAR)); // 10 is enough for our case, WCHAR for BSTR
74 snprintf(pBuffer, 10, "%d", i);
75 return pBuffer;
76}
77
78
79
80TestStruct* InitTestStruct()
81{
82 TestStruct *expected = (TestStruct *)CoreClrAlloc( sizeof(TestStruct) * ARRAY_SIZE );
83
84 for ( int i = 0; i < ARRAY_SIZE; i++)
85 {
86 expected[i].x = i;
87 expected[i].d = i;
88 expected[i].l = i;
89 expected[i].str = ToString(i);
90 }
91
92 return expected;
93}
94
95template<typename T>
96BOOL Equals(T *pActual, int cActual, T *pExpected, int cExpected)
97{
98 if ( pActual == NULL && pExpected == NULL )
99 return TRUE;
100 else if ( cActual != cExpected )
101 {
102 printf("WARNING: Test error - %s\n", __FUNCSIG__);
103 return FALSE;
104 }
105
106 for ( int i = 0; i < cExpected; ++i )
107 {
108 if ( !IsObjectEquals(pActual[i], pExpected[i]) )
109 {
110 printf("WARNING: Test error - %s\n", __FUNCSIG__);
111 return FALSE;
112 }
113 }
114
115 return TRUE;
116}
117
118template<typename T> bool IsObjectEquals(T o1, T o2)
119{
120 // T::operator== required.
121 return o1 == o2;
122}
123
124template<>
125bool IsObjectEquals(LPSTR o1, LPSTR o2)
126{
127 size_t cLen1 = strlen(o1);
128 size_t cLen2 = strlen(o2);
129
130 if (cLen1 != cLen2 )
131 {
132 printf("Not equals in %s\n",__FUNCTION__);
133 return false;
134 }
135
136 return strncmp(o1, o2, cLen1) == 0;
137}
138
139template<>
140bool IsObjectEquals(LPCSTR o1, LPCSTR o2)
141{
142 size_t cLen1 = strlen(o1);
143 size_t cLen2 = strlen(o2);
144
145 if (cLen1 != cLen2 )
146 {
147 printf("Not equals in %s\n",__FUNCTION__);
148 return false;
149 }
150
151 return strncmp(o1, o2, cLen1) == 0;
152}
153
154
155bool TestStructEquals(TestStruct Actual[], TestStruct Expected[])
156{
157 if ( Actual == NULL && Expected == NULL )
158 return true;
159 else if ( Actual == NULL && Expected != NULL )
160 return false;
161 else if ( Actual != NULL && Expected == NULL )
162 return false;
163
164 for ( size_t i = 0; i < ARRAY_SIZE; ++i )
165 {
166 if ( !(IsObjectEquals(Actual[i].x, Expected[i].x) &&
167 IsObjectEquals(Actual[i].d, Expected[i].d) &&
168 IsObjectEquals(Actual[i].l, Expected[i].l) &&
169 IsObjectEquals(Actual[i].str, Expected[i].str) ))
170 {
171 printf("WARNING: Test error - %s\n", __FUNCSIG__);
172 return false;
173 }
174 }
175
176 return true;
177}
178
179/*----------------------------------------------------------------------------
180
181Function
182
183----------------------------------------------------------------------------*/
184
185/*----------------------------------------------------------------------------
186marshal sequential strut
187----------------------------------------------------------------------------*/
188extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE TakeIntArraySeqStructByVal( S_INTArray s, int size )
189{
190 CHECK_PARAM_NOT_EMPTY( s.arr );
191 INIT_EXPECTED( INT, ARRAY_SIZE );
192 return Equals( s.arr, size, expected, ARRAY_SIZE );
193}
194
195extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE TakeUIntArraySeqStructByVal( S_UINTArray s, int size )
196{
197 CHECK_PARAM_NOT_EMPTY( s.arr );
198 INIT_EXPECTED( UINT, ARRAY_SIZE );
199 return Equals( s.arr, size, expected, ARRAY_SIZE );
200}
201
202extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE TakeShortArraySeqStructByVal( S_SHORTArray s, int size )
203{
204 CHECK_PARAM_NOT_EMPTY( s.arr );
205 INIT_EXPECTED( SHORT, ARRAY_SIZE );
206 return Equals( s.arr, size, expected, ARRAY_SIZE );
207}
208
209extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE TakeWordArraySeqStructByVal( S_WORDArray s, int size )
210{
211 CHECK_PARAM_NOT_EMPTY( s.arr );
212 INIT_EXPECTED( WORD, ARRAY_SIZE );
213 return Equals( s.arr, size, expected, ARRAY_SIZE );
214}
215
216extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE TakeLong64ArraySeqStructByVal( S_LONG64Array s, int size )
217{
218 CHECK_PARAM_NOT_EMPTY( s.arr );
219 INIT_EXPECTED( LONG64, ARRAY_SIZE );
220 return Equals( s.arr, size, expected, ARRAY_SIZE );
221}
222
223extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE TakeULong64ArraySeqStructByVal( S_ULONG64Array s, int size )
224{
225 CHECK_PARAM_NOT_EMPTY( s.arr );
226 INIT_EXPECTED( ULONG64, ARRAY_SIZE );
227 return Equals( s.arr, size, expected, ARRAY_SIZE );
228}
229
230extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE TakeDoubleArraySeqStructByVal( S_DOUBLEArray s, int size )
231{
232 CHECK_PARAM_NOT_EMPTY( s.arr );
233 INIT_EXPECTED( DOUBLE, ARRAY_SIZE );
234 return Equals( s.arr, size, expected, ARRAY_SIZE );
235}
236
237extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE TakeFloatArraySeqStructByVal( S_FLOATArray s, int size )
238{
239 CHECK_PARAM_NOT_EMPTY( s.arr );
240 INIT_EXPECTED( FLOAT, ARRAY_SIZE );
241 return Equals( s.arr, size, expected, ARRAY_SIZE );
242}
243
244extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE TakeByteArraySeqStructByVal( S_BYTEArray s, int size )
245{
246 CHECK_PARAM_NOT_EMPTY( s.arr );
247 INIT_EXPECTED( BYTE, ARRAY_SIZE );
248 return Equals( s.arr, size, expected, ARRAY_SIZE );
249}
250
251extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE TakeCharArraySeqStructByVal( S_CHARArray s, int size )
252{
253 CHECK_PARAM_NOT_EMPTY( s.arr );
254 INIT_EXPECTED( CHAR, ARRAY_SIZE );
255 return Equals( s.arr, size, expected, ARRAY_SIZE );
256}
257
258extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE TakeIntPtrArraySeqStructByVal(S_DWORD_PTRArray s, int size)
259{
260 CHECK_PARAM_NOT_EMPTY(s.arr);
261 INIT_EXPECTED( DWORD_PTR, ARRAY_SIZE);
262 return Equals(s.arr, size, expected, ARRAY_SIZE);
263}
264
265extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE TakeLPSTRArraySeqStructByVal( S_LPSTRArray s, int size )
266{
267 CHECK_PARAM_NOT_EMPTY( s.arr );
268
269 LPSTR expected[ARRAY_SIZE];
270 for ( int i = 0; i < ARRAY_SIZE; ++i )
271 expected[i] = ToString(i);
272
273 return Equals( s.arr, size, expected, ARRAY_SIZE );
274}
275
276extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE TakeLPCSTRArraySeqStructByVal( S_LPCSTRArray s, int size )
277{
278 CHECK_PARAM_NOT_EMPTY( s.arr );
279
280 LPSTR expected[ARRAY_SIZE];
281 for ( int i = 0; i < ARRAY_SIZE; ++i )
282 expected[i] = ToString(i);
283
284 return Equals( s.arr, size, (LPCSTR *)expected, ARRAY_SIZE );
285}
286
287
288
289extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE TakeStructArraySeqStructByVal( S_StructArray s, int size )
290{
291 CHECK_PARAM_NOT_EMPTY( s.arr );
292
293 TestStruct *expected = InitTestStruct();
294 return TestStructEquals( s.arr,expected );
295}
296
297/*----------------------------------------------------------------------------
298marshal sequential class
299----------------------------------------------------------------------------*/
300extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE TakeIntArraySeqClassByVal( S_INTArray *s, int size )
301{
302 return TakeIntArraySeqStructByVal( *s, size );
303}
304
305extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE TakeUIntArraySeqClassByVal( S_UINTArray *s, int size )
306{
307 return TakeUIntArraySeqStructByVal( *s, size );
308}
309
310extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE TakeShortArraySeqClassByVal( S_SHORTArray *s, int size )
311{
312 return TakeShortArraySeqStructByVal( *s, size );
313}
314
315extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE TakeWordArraySeqClassByVal( S_WORDArray *s, int size )
316{
317 return TakeWordArraySeqStructByVal( *s, size );
318}
319
320extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE TakeLong64ArraySeqClassByVal( S_LONG64Array *s, int size )
321{
322 return TakeLong64ArraySeqStructByVal( *s, size );
323}
324
325extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE TakeULong64ArraySeqClassByVal( S_ULONG64Array *s, int size )
326{
327 return TakeULong64ArraySeqStructByVal( *s, size );
328}
329
330extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE TakeDoubleArraySeqClassByVal( S_DOUBLEArray *s, int size )
331{
332 return TakeDoubleArraySeqStructByVal( *s, size );
333}
334
335extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE TakeFloatArraySeqClassByVal( S_FLOATArray *s, int size )
336{
337 return TakeFloatArraySeqStructByVal( *s, size );
338}
339
340extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE TakeByteArraySeqClassByVal( S_BYTEArray *s, int size )
341{
342 return TakeByteArraySeqStructByVal( *s, size );
343}
344
345extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE TakeCharArraySeqClassByVal( S_CHARArray *s, int size )
346{
347 return TakeCharArraySeqStructByVal( *s, size );
348}
349
350extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE TakeLPSTRArraySeqClassByVal( S_LPSTRArray *s, int size )
351{
352 return TakeLPSTRArraySeqStructByVal( *s, size );
353}
354
355extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE TakeLPCSTRArraySeqClassByVal( S_LPCSTRArray *s, int size )
356{
357 return TakeLPCSTRArraySeqStructByVal( *s, size );
358}
359
360
361
362extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE TakeStructArraySeqClassByVal( S_StructArray *s, int size )
363{
364 return TakeStructArraySeqStructByVal( *s, size );
365}
366
367/*----------------------------------------------------------------------------
368marshal explicit struct
369----------------------------------------------------------------------------*/
370extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE TakeIntArrayExpStructByVal( S_INTArray s, int size )
371{
372 return TakeIntArraySeqStructByVal( s, size );
373}
374
375extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE TakeUIntArrayExpStructByVal( S_UINTArray s, int size )
376{
377 return TakeUIntArraySeqStructByVal( s, size );
378}
379
380extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE TakeShortArrayExpStructByVal( S_SHORTArray s, int size )
381{
382 return TakeShortArraySeqStructByVal( s, size );
383}
384
385extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE TakeWordArrayExpStructByVal( S_WORDArray s, int size )
386{
387 return TakeWordArraySeqStructByVal( s, size );
388}
389
390extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE TakeLong64ArrayExpStructByVal( S_LONG64Array s, int size )
391{
392 return TakeLong64ArraySeqStructByVal( s, size );
393}
394
395extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE TakeULong64ArrayExpStructByVal( S_ULONG64Array s, int size )
396{
397 return TakeULong64ArraySeqStructByVal( s, size );
398}
399
400extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE TakeDoubleArrayExpStructByVal( S_DOUBLEArray s, int size )
401{
402 return TakeDoubleArraySeqStructByVal( s, size );
403}
404
405extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE TakeFloatArrayExpStructByVal( S_FLOATArray s, int size )
406{
407 return TakeFloatArraySeqStructByVal( s, size );
408}
409
410extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE TakeByteArrayExpStructByVal( S_BYTEArray s, int size )
411{
412 return TakeByteArraySeqStructByVal( s, size );
413}
414
415extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE TakeCharArrayExpStructByVal( S_CHARArray s, int size )
416{
417 return TakeCharArraySeqStructByVal( s, size );
418}
419
420extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE TakeLPSTRArrayExpStructByVal( S_LPSTRArray s, int size )
421{
422 return TakeLPSTRArraySeqStructByVal( s, size );
423}
424
425extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE TakeLPCSTRArrayExpStructByVal( S_LPCSTRArray s, int size )
426{
427 return TakeLPCSTRArraySeqStructByVal( s, size );
428}
429
430
431
432extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE TakeStructArrayExpStructByVal( S_StructArray s, int size )
433{
434 return TakeStructArraySeqStructByVal( s, size );
435}
436
437/*----------------------------------------------------------------------------
438marshal explicit class
439----------------------------------------------------------------------------*/
440extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE TakeIntArrayExpClassByVal( S_INTArray *s, int size )
441{
442 return TakeIntArraySeqStructByVal( *s, size );
443}
444
445extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE TakeUIntArrayExpClassByVal( S_UINTArray *s, int size )
446{
447 return TakeUIntArraySeqStructByVal( *s, size );
448}
449
450extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE TakeShortArrayExpClassByVal( S_SHORTArray *s, int size )
451{
452 return TakeShortArraySeqStructByVal( *s, size );
453}
454
455extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE TakeWordArrayExpClassByVal( S_WORDArray *s, int size )
456{
457 return TakeWordArraySeqStructByVal( *s, size );
458}
459
460extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE TakeLong64ArrayExpClassByVal( S_LONG64Array *s, int size )
461{
462 return TakeLong64ArraySeqStructByVal( *s, size );
463}
464
465extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE TakeULong64ArrayExpClassByVal( S_ULONG64Array *s, int size )
466{
467 return TakeULong64ArraySeqStructByVal( *s, size );
468}
469
470extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE TakeDoubleArrayExpClassByVal( S_DOUBLEArray *s, int size )
471{
472 return TakeDoubleArraySeqStructByVal( *s, size );
473}
474
475extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE TakeFloatArrayExpClassByVal( S_FLOATArray *s, int size )
476{
477 return TakeFloatArraySeqStructByVal( *s, size );
478}
479
480extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE TakeByteArrayExpClassByVal( S_BYTEArray *s, int size )
481{
482 return TakeByteArraySeqStructByVal( *s, size );
483}
484
485extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE TakeCharArrayExpClassByVal( S_CHARArray *s, int size )
486{
487 return TakeCharArraySeqStructByVal( *s, size );
488}
489
490extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE TakeLPSTRArrayExpClassByVal( S_LPSTRArray *s, int size )
491{
492 return TakeLPSTRArraySeqStructByVal( *s, size );
493}
494
495extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE TakeLPCSTRArrayExpClassByVal( S_LPCSTRArray *s, int size )
496{
497 return TakeLPCSTRArraySeqStructByVal( *s, size );
498}
499
500
501
502extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE TakeStructArrayExpClassByVal( S_StructArray *s, int size )
503{
504 return TakeStructArraySeqStructByVal( *s, size );
505}
506
507/*----------------------------------------------------------------------------
508return a struct including a C array
509----------------------------------------------------------------------------*/
510extern "C" DLL_EXPORT S_INTArray* STDMETHODCALLTYPE S_INTArray_Ret()
511{
512 INIT_EXPECTED_STRUCT( S_INTArray, ARRAY_SIZE, INT );
513
514 return expected;
515}
516
517extern "C" DLL_EXPORT S_UINTArray* STDMETHODCALLTYPE S_UINTArray_Ret()
518{
519 INIT_EXPECTED_STRUCT( S_UINTArray, ARRAY_SIZE, UINT );
520
521 return expected;
522}
523
524extern "C" DLL_EXPORT S_SHORTArray* STDMETHODCALLTYPE S_SHORTArray_Ret()
525{
526 INIT_EXPECTED_STRUCT( S_SHORTArray, ARRAY_SIZE, SHORT );
527
528 return expected;
529}
530
531extern "C" DLL_EXPORT S_WORDArray* STDMETHODCALLTYPE S_WORDArray_Ret()
532{
533 INIT_EXPECTED_STRUCT( S_WORDArray, ARRAY_SIZE, WORD );
534
535 return expected;
536}
537
538extern "C" DLL_EXPORT S_LONG64Array* STDMETHODCALLTYPE S_LONG64Array_Ret()
539{
540 INIT_EXPECTED_STRUCT( S_LONG64Array, ARRAY_SIZE, LONG64 );
541
542 return expected;
543}
544
545extern "C" DLL_EXPORT S_ULONG64Array* STDMETHODCALLTYPE S_ULONG64Array_Ret()
546{
547 INIT_EXPECTED_STRUCT( S_ULONG64Array, ARRAY_SIZE, ULONG64 );
548
549 return expected;
550}
551
552extern "C" DLL_EXPORT S_DOUBLEArray* STDMETHODCALLTYPE S_DOUBLEArray_Ret()
553{
554 INIT_EXPECTED_STRUCT( S_DOUBLEArray, ARRAY_SIZE, DOUBLE );
555
556 return expected;
557}
558
559extern "C" DLL_EXPORT S_FLOATArray* STDMETHODCALLTYPE S_FLOATArray_Ret()
560{
561 INIT_EXPECTED_STRUCT( S_FLOATArray, ARRAY_SIZE, FLOAT );
562
563 return expected;
564}
565
566extern "C" DLL_EXPORT S_BYTEArray* STDMETHODCALLTYPE S_BYTEArray_Ret()
567{
568 INIT_EXPECTED_STRUCT( S_BYTEArray, ARRAY_SIZE, BYTE );
569
570 return expected;
571}
572
573extern "C" DLL_EXPORT S_CHARArray* STDMETHODCALLTYPE S_CHARArray_Ret()
574{
575 INIT_EXPECTED_STRUCT( S_CHARArray, ARRAY_SIZE, CHAR );
576
577 return expected;
578}
579
580extern "C" DLL_EXPORT S_LPSTRArray* STDMETHODCALLTYPE S_LPSTRArray_Ret()
581{
582 S_LPSTRArray *expected = (S_LPSTRArray *)CoreClrAlloc( sizeof(S_LPSTRArray) );
583 for ( int i = 0; i < ARRAY_SIZE; ++i )
584 expected->arr[i] = ToString(i);
585
586 return expected;
587}
588
589
590extern "C" DLL_EXPORT S_StructArray* STDMETHODCALLTYPE S_StructArray_Ret()
591{
592 S_StructArray *expected = (S_StructArray *)CoreClrAlloc( sizeof(S_StructArray) );
593 for ( int i = 0; i < ARRAY_SIZE; ++i )
594 {
595 expected->arr[i].x = i;
596 expected->arr[i].d = i;
597 expected->arr[i].l = i;
598 expected->arr[i].str = ToString(i);
599 }
600
601 return expected;
602}
603