1#include <stdio.h>
2
3#if defined(__clang__)
4#define EXPORT(type) __attribute__((visibility("default"))) extern "C" type
5#else // defined(__clang__)
6#define EXPORT(type) type
7#endif // !defined(__clang__)
8
9#if !defined(_MSC_VER)
10#if __i386__
11#define __stdcall __attribute__((stdcall))
12#else // __i386__
13#define __stdcall
14#endif // !__i386__
15#endif // !defined(_MSC_VER)
16
17#ifdef _MSC_VER
18#define CALLBACK __stdcall
19#define NATIVEAPI __stdcall
20#else // _MSC_VER
21#define CALLBACK
22#define NATIVEAPI
23#endif // !_MSC_VER
24
25typedef unsigned char byte;
26
27struct S1
28{
29 int x;
30 int y;
31 int z;
32 int w;
33};
34
35struct S2
36{
37 int x;
38 int y;
39 float z;
40};
41
42struct S3
43{
44 int x;
45 int y;
46 double z;
47};
48
49struct S4
50{
51 int x;
52 float y;
53};
54
55struct S5
56{
57 int x;
58 double y;
59};
60
61struct S6
62{
63 short x;
64 short y;
65 int z;
66 int w;
67};
68
69struct S7
70{
71 double x;
72 int y;
73 int z;
74};
75
76struct S8
77{
78 double x;
79 int y;
80};
81
82struct S9
83{
84 int x;
85 int y;
86 float z;
87 float w;
88};
89
90struct S10
91{
92 byte a;
93 byte b;
94 byte c;
95 byte d;
96 byte e;
97 byte f;
98 byte g;
99 byte h;
100};
101
102struct S11
103{
104 byte a;
105 byte b;
106 byte c;
107 byte d;
108 double e;
109};
110
111struct S12
112{
113 byte a;
114 byte b;
115 byte c;
116 byte d;
117 byte e;
118 byte f;
119 byte g;
120 byte h;
121 long long i;
122};
123
124struct S13
125{
126 byte hasValue;
127 int x;
128};
129
130struct S14
131{
132 byte x;
133 long long y;
134};
135
136struct S15
137{
138 byte a;
139 byte b;
140 byte c;
141 byte d;
142 byte e;
143 byte f;
144 byte g;
145 byte h;
146 byte i;
147};
148
149struct S16
150{
151 byte x;
152 short y;
153};
154
155struct S17
156{
157 float x;
158 float y;
159};
160
161struct S18
162{
163 float x;
164 int y;
165 float z;
166};
167
168struct S19
169{
170 int x;
171 float y;
172 int z;
173 float w;
174};
175
176struct S20
177{
178 long long x;
179 long long y;
180 long long z;
181 long long w;
182};
183
184struct S28
185{
186 void* x;
187 int y;
188};
189
190struct S29
191{
192 int x;
193 void* y;
194};
195
196struct S30
197{
198 long long x;
199 long long y;
200};
201
202typedef void (CALLBACK *PFNACTION1)(S1 s);
203typedef void (CALLBACK *PFNACTION2)(S2 s);
204typedef void (CALLBACK *PFNACTION3)(S3 s);
205typedef void (CALLBACK *PFNACTION4)(S4 s);
206typedef void (CALLBACK *PFNACTION5)(S5 s);
207typedef void (CALLBACK *PFNACTION6)(S6 s);
208typedef void (CALLBACK *PFNACTION7)(S7 s);
209typedef void (CALLBACK *PFNACTION8)(S8 s);
210typedef void (CALLBACK *PFNACTION9)(S9 s);
211typedef void (CALLBACK *PFNACTION10)(S10 s);
212typedef void (CALLBACK *PFNACTION11)(S11 s);
213typedef void (CALLBACK *PFNACTION12)(S12 s);
214typedef void (CALLBACK *PFNACTION13)(S13 s);
215typedef void (CALLBACK *PFNACTION14)(S14 s);
216typedef void (CALLBACK *PFNACTION15)(S15 s);
217typedef void (CALLBACK *PFNACTION16)(S16 s);
218typedef void (CALLBACK *PFNACTION17)(S17 s);
219typedef void (CALLBACK *PFNACTION18)(S18 s);
220typedef void (CALLBACK *PFNACTION19)(S19 s);
221typedef void (CALLBACK *PFNACTION20)(S20 s);
222
223typedef void (CALLBACK *PFNACTION28)(S28 s);
224typedef void (CALLBACK *PFNACTION29)(S29 s);
225typedef void (CALLBACK *PFNACTION30)(S30 s1, S30 s2, S30 s3);
226
227EXPORT(void) NATIVEAPI InvokeCallback1(PFNACTION1 callback, S1 s)
228{
229 printf("Native S1: %d, %d, %d, %d\n", s.x, s.y, s.z, s.w);
230 callback(s);
231}
232
233EXPORT(void) NATIVEAPI InvokeCallback2(PFNACTION2 callback, S2 s)
234{
235 printf("Native S2: %d, %d, %f\n", s.x, s.y, s.z);
236 callback(s);
237}
238EXPORT(void) NATIVEAPI InvokeCallback3(PFNACTION3 callback, S3 s)
239{
240 printf("Native S3: %d, %d, %f\n", s.x, s.y, s.z);
241 callback(s);
242}
243EXPORT(void) NATIVEAPI InvokeCallback4(PFNACTION4 callback, S4 s)
244{
245 printf("Native S4: %d, %f\n", s.x, s.y);
246 callback(s);
247}
248EXPORT(void) NATIVEAPI InvokeCallback5(PFNACTION5 callback, S5 s)
249{
250 printf("Native S5: %d, %f\n", s.x, s.y);
251 callback(s);
252}
253EXPORT(void) NATIVEAPI InvokeCallback6(PFNACTION6 callback, S6 s)
254{
255 printf("Native S6: %hd, %hd, %d, %d\n", s.x, s.y, s.z, s.w);
256 callback(s);
257}
258EXPORT(void) NATIVEAPI InvokeCallback7(PFNACTION7 callback, S7 s)
259{
260 printf("Native S7: %f, %d, %d\n", s.x, s.y, s.z);
261 callback(s);
262}
263EXPORT(void) NATIVEAPI InvokeCallback8(PFNACTION8 callback, S8 s)
264{
265 printf("Native S8: %f, %d\n", s.x, s.y);
266 callback(s);
267}
268EXPORT(void) NATIVEAPI InvokeCallback9(PFNACTION9 callback, S9 s)
269{
270 printf("Native S9: %d, %d, %f, %f\n", s.x, s.y, s.z, s.w);
271 callback(s);
272}
273EXPORT(void) NATIVEAPI InvokeCallback10(PFNACTION10 callback, S10 s)
274{
275 printf("Native S10: %hhd, %hhd, %hhd, %hhd, %hhd, %hhd, %hhd, %hhd\n", s.a, s.b, s.c, s.d, s.e, s.f, s.g, s.h);
276 callback(s);
277}
278
279EXPORT(void) NATIVEAPI InvokeCallback11(PFNACTION11 callback, S11 s)
280{
281 printf("Native S11: %hhd, %hhd, %hhd, %hhd, %f\n", s.a, s.b, s.c, s.d, s.e);
282 callback(s);
283}
284EXPORT(void) NATIVEAPI InvokeCallback12(PFNACTION12 callback, S12 s)
285{
286 printf("Native S12: %hhd, %hhd, %hhd, %hhd, %hhd, %hhd, %hhd, %hhd, %lld\n", s.a, s.b, s.c, s.d, s.e, s.f, s.g, s.h, s.i);
287 callback(s);
288}
289EXPORT(void) NATIVEAPI InvokeCallback13(PFNACTION13 callback, S13 s)
290{
291 printf("Native S13: %hhd, %d\n", s.hasValue, s.x);
292 callback(s);
293}
294EXPORT(void) NATIVEAPI InvokeCallback14(PFNACTION14 callback, S14 s)
295{
296 printf("Native S13: %hhd, %lld\n", s.x, s.y);
297 callback(s);
298}
299EXPORT(void) NATIVEAPI InvokeCallback15(PFNACTION15 callback, S15 s)
300{
301 printf("Native S15: %hhd, %hhd, %hhd, %hhd, %hhd, %hhd, %hhd, %hhd, %hhd\n", s.a, s.b, s.c, s.d, s.e, s.f, s.g, s.h, s.i);
302 callback(s);
303}
304EXPORT(void) NATIVEAPI InvokeCallback16(PFNACTION16 callback, S16 s)
305{
306 printf("Native S16: %hhd, %hd\n", s.x, s.y);
307 callback(s);
308}
309EXPORT(void) NATIVEAPI InvokeCallback17(PFNACTION17 callback, S17 s)
310{
311 printf("Native S17: %f, %f\n", s.x, s.y);
312 callback(s);
313}
314EXPORT(void) NATIVEAPI InvokeCallback18(PFNACTION18 callback, S18 s)
315{
316 printf("Native S18: %f, %d, %f\n", s.x, s.y, s.z);
317 callback(s);
318}
319EXPORT(void) NATIVEAPI InvokeCallback19(PFNACTION19 callback, S19 s)
320{
321 printf("Native S19: %d, %f, %d, %f\n", s.x, s.y, s.z, s.w);
322 callback(s);
323}
324
325EXPORT(void) NATIVEAPI InvokeCallback20(PFNACTION20 callback, S20 s)
326{
327#ifdef __clang__
328 printf("Native S20: %lld, %lld, %lld, %lld\n", s.x, s.y, s.z, s.w);
329#else
330 printf("Native S20: %I64d, %I64d, %I64d, %I64d\n", s.x, s.y, s.z, s.w);
331#endif
332
333 callback(s);
334}
335
336EXPORT(void) NATIVEAPI InvokeCallback28(PFNACTION28 callback, S28 s)
337{
338 printf("Native S28: %p object, %d\n", s.x, s.y);
339 callback(s);
340}
341EXPORT(void) NATIVEAPI InvokeCallback29(PFNACTION29 callback, S29 s)
342{
343 printf("Native S29: %d, %p object\n", s.x, s.y);
344 callback(s);
345}
346
347EXPORT(void) NATIVEAPI InvokeCallback30(PFNACTION30 callback, S30 s1, S30 s2, S30 s3)
348{
349 printf("Native S30: %lld, %lld, %lld, %lld, %lld, %lld\n", s1.x, s1.y, s2.x, s2.y, s3.x, s3.y);
350 callback(s1, s2, s3);
351}
352
353EXPORT(S1) NATIVEAPI InvokeCallback1R(PFNACTION1 callback, S1 s)
354{
355 printf("Native S1: %d, %d, %d, %d\n", s.x, s.y, s.z, s.w);
356 callback(s);
357 return s;
358}
359
360EXPORT(S2) NATIVEAPI InvokeCallback2R(PFNACTION2 callback, S2 s)
361{
362 printf("Native S2: %d, %d, %f\n", s.x, s.y, s.z);
363 callback(s);
364 return s;
365}
366EXPORT(S3) NATIVEAPI InvokeCallback3R(PFNACTION3 callback, S3 s)
367{
368 printf("Native S3: %d, %d, %f\n", s.x, s.y, s.z);
369 callback(s);
370 return s;
371}
372EXPORT(S4) NATIVEAPI InvokeCallback4R(PFNACTION4 callback, S4 s)
373{
374 printf("Native S4: %d, %f\n", s.x, s.y);
375 callback(s);
376 return s;
377}
378EXPORT(S5) NATIVEAPI InvokeCallback5R(PFNACTION5 callback, S5 s)
379{
380 printf("Native S5: %d, %f\n", s.x, s.y);
381 callback(s);
382 return s;
383}
384EXPORT(S6) NATIVEAPI InvokeCallback6R(PFNACTION6 callback, S6 s)
385{
386 printf("Native S6: %hd, %hd, %d, %d\n", s.x, s.y, s.z, s.w);
387 callback(s);
388 return s;
389}
390EXPORT(S7) NATIVEAPI InvokeCallback7R(PFNACTION7 callback, S7 s)
391{
392 printf("Native S7: %f, %d, %d\n", s.x, s.y, s.z);
393 callback(s);
394 return s;
395}
396EXPORT(S8) NATIVEAPI InvokeCallback8R(PFNACTION8 callback, S8 s)
397{
398 printf("Native S8: %f, %d\n", s.x, s.y);
399 callback(s);
400 return s;
401}
402EXPORT(S9) NATIVEAPI InvokeCallback9R(PFNACTION9 callback, S9 s)
403{
404 printf("Native S9: %d, %d, %f, %f\n", s.x, s.y, s.z, s.w);
405 callback(s);
406 return s;
407}
408EXPORT(S10) NATIVEAPI InvokeCallback10R(PFNACTION10 callback, S10 s)
409{
410 printf("Native S10: %hhd, %hhd, %hhd, %hhd, %hhd, %hhd, %hhd, %hhd\n", s.a, s.b, s.c, s.d, s.e, s.f, s.g, s.h);
411 callback(s);
412 return s;
413}
414EXPORT(S11) NATIVEAPI InvokeCallback11R(PFNACTION11 callback, S11 s)
415{
416 printf("Native S11: %hhd, %hhd, %hhd, %hhd, %f\n", s.a, s.b, s.c, s.d, s.e);
417 callback(s);
418 return s;
419}
420EXPORT(S12) NATIVEAPI InvokeCallback12R(PFNACTION12 callback, S12 s)
421{
422 printf("Native S12: %hhd, %hhd, %hhd, %hhd, %hhd, %hhd, %hhd, %hhd, %lld\n", s.a, s.b, s.c, s.d, s.e, s.f, s.g, s.h, s.i);
423 callback(s);
424 return s;
425}
426EXPORT(S13) NATIVEAPI InvokeCallback13R(PFNACTION13 callback, S13 s)
427{
428 printf("Native S13: %hhd, %d\n", s.hasValue, s.x);
429 callback(s);
430 return s;
431}
432EXPORT(S14) NATIVEAPI InvokeCallback14R(PFNACTION14 callback, S14 s)
433{
434 printf("Native S13: %hhd, %lld\n", s.x, s.y);
435 callback(s);
436 return s;
437}
438EXPORT(S15) NATIVEAPI InvokeCallback15R(PFNACTION15 callback, S15 s)
439{
440 printf("Native S15: %hhd, %hhd, %hhd, %hhd, %hhd, %hhd, %hhd, %hhd, %hhd\n", s.a, s.b, s.c, s.d, s.e, s.f, s.g, s.h, s.i);
441 callback(s);
442 return s;
443}
444EXPORT(S16) NATIVEAPI InvokeCallback16R(PFNACTION16 callback, S16 s)
445{
446 printf("Native S16: %hhd, %hd\n", s.x, s.y);
447 callback(s);
448 return s;
449}
450EXPORT(S17) NATIVEAPI InvokeCallback17R(PFNACTION17 callback, S17 s)
451{
452 printf("Native S17: %f, %f\n", s.x, s.y);
453 callback(s);
454 return s;
455}
456EXPORT(S18) NATIVEAPI InvokeCallback18R(PFNACTION18 callback, S18 s)
457{
458 printf("Native S18: %f, %d, %f\n", s.x, s.y, s.z);
459 callback(s);
460 return s;
461}
462EXPORT(S19) NATIVEAPI InvokeCallback19R(PFNACTION19 callback, S19 s)
463{
464 printf("Native S19: %d, %f, %d, %f\n", s.x, s.y, s.z, s.w);
465 callback(s);
466 return s;
467}
468
469EXPORT(S20) NATIVEAPI InvokeCallback20R(PFNACTION20 callback, S20 s)
470{
471#ifdef __clang__
472 printf("Native S20: %lld, %lld, %lld, %lld\n", s.x, s.y, s.z, s.w);
473#else
474 printf("Native S20: %I64d, %I64d, %I64d, %I64d\n", s.x, s.y, s.z, s.w);
475#endif
476 callback(s);
477 return s;
478}
479
480EXPORT(S28) NATIVEAPI InvokeCallback28R(PFNACTION28 callback, S28 s)
481{
482 printf("Native S28: %p object, %d\n", s.x, s.y);
483 callback(s);
484 return s;
485}
486EXPORT(S29) NATIVEAPI InvokeCallback29R(PFNACTION29 callback, S29 s)
487{
488 printf("Native S29: %d, %p object\n", s.x, s.y);
489 callback(s);
490 return s;
491}
492