| 1 | // Copyright (c) Microsoft. All rights reserved. |
| 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. |
| 3 | |
| 4 | #include <stdint.h> |
| 5 | |
| 6 | #ifdef _MSC_VER |
| 7 | #define DLLEXPORT __declspec(dllexport) |
| 8 | #else |
| 9 | #define DLLEXPORT __attribute__((visibility("default"))) |
| 10 | #endif // _MSC_VER |
| 11 | |
| 12 | struct SingleByte |
| 13 | { |
| 14 | uint8_t Byte; |
| 15 | }; |
| 16 | |
| 17 | struct SingleLong |
| 18 | { |
| 19 | uint64_t Long; |
| 20 | }; |
| 21 | |
| 22 | struct SingleFloat |
| 23 | { |
| 24 | float Float; |
| 25 | }; |
| 26 | |
| 27 | struct SingleDouble |
| 28 | { |
| 29 | double Double; |
| 30 | }; |
| 31 | |
| 32 | struct ByteAndFloat |
| 33 | { |
| 34 | uint8_t Byte; |
| 35 | float Float; |
| 36 | }; |
| 37 | |
| 38 | struct FloatAndByte |
| 39 | { |
| 40 | float Float; |
| 41 | uint8_t Byte; |
| 42 | }; |
| 43 | |
| 44 | struct LongAndFloat |
| 45 | { |
| 46 | uint64_t Long; |
| 47 | float Float; |
| 48 | }; |
| 49 | |
| 50 | struct ByteAndDouble |
| 51 | { |
| 52 | uint8_t Byte; |
| 53 | double Double; |
| 54 | }; |
| 55 | |
| 56 | struct DoubleAndByte |
| 57 | { |
| 58 | double Double; |
| 59 | uint8_t Byte; |
| 60 | }; |
| 61 | |
| 62 | struct PointerAndByte |
| 63 | { |
| 64 | void* Pointer; |
| 65 | uint8_t Byte; |
| 66 | }; |
| 67 | |
| 68 | struct ByteAndPointer |
| 69 | { |
| 70 | uint8_t Byte; |
| 71 | void* Pointer; |
| 72 | }; |
| 73 | |
| 74 | struct ByteFloatAndPointer |
| 75 | { |
| 76 | uint8_t Byte; |
| 77 | float Float; |
| 78 | void* Pointer; |
| 79 | }; |
| 80 | |
| 81 | struct PointerFloatAndByte |
| 82 | { |
| 83 | void* Pointer; |
| 84 | float Float; |
| 85 | uint8_t Byte; |
| 86 | }; |
| 87 | |
| 88 | struct ShortIntFloatIntPtr |
| 89 | { |
| 90 | __int16 Short; |
| 91 | __int32 Int; |
| 92 | float Float; |
| 93 | __int32* Pointer; |
| 94 | }; |
| 95 | |
| 96 | struct TwoLongs |
| 97 | { |
| 98 | uint64_t Long1; |
| 99 | uint64_t Long2; |
| 100 | }; |
| 101 | |
| 102 | struct TwoFloats |
| 103 | { |
| 104 | float Float1; |
| 105 | float Float2; |
| 106 | }; |
| 107 | |
| 108 | struct TwoDoubles |
| 109 | { |
| 110 | double Double1; |
| 111 | double Double2; |
| 112 | }; |
| 113 | |
| 114 | struct FourLongs |
| 115 | { |
| 116 | uint64_t Long1; |
| 117 | uint64_t Long2; |
| 118 | uint64_t Long3; |
| 119 | uint64_t Long4; |
| 120 | }; |
| 121 | |
| 122 | struct FourDoubles |
| 123 | { |
| 124 | double Double1; |
| 125 | double Double2; |
| 126 | double Double3; |
| 127 | double Double4; |
| 128 | }; |
| 129 | |
| 130 | struct InlineArray1 |
| 131 | { |
| 132 | uint8_t Array[16]; |
| 133 | }; |
| 134 | |
| 135 | struct InlineArray2 |
| 136 | { |
| 137 | float Array[4]; |
| 138 | }; |
| 139 | |
| 140 | struct InlineArray3 |
| 141 | { |
| 142 | float Array[3]; |
| 143 | }; |
| 144 | |
| 145 | struct InlineArray4 |
| 146 | { |
| 147 | uint16_t Array[5]; |
| 148 | }; |
| 149 | |
| 150 | struct InlineArray5 |
| 151 | { |
| 152 | uint8_t Array[9]; |
| 153 | }; |
| 154 | |
| 155 | struct InlineArray6 |
| 156 | { |
| 157 | double Array[1]; |
| 158 | }; |
| 159 | |
| 160 | struct Nested1 |
| 161 | { |
| 162 | struct LongAndFloat Field1; |
| 163 | struct LongAndFloat Field2; |
| 164 | }; |
| 165 | |
| 166 | struct Nested2 |
| 167 | { |
| 168 | struct ByteAndFloat Field1; |
| 169 | struct FloatAndByte Field2; |
| 170 | }; |
| 171 | |
| 172 | struct Nested3 |
| 173 | { |
| 174 | void* Field1; |
| 175 | struct FloatAndByte Field2; |
| 176 | }; |
| 177 | |
| 178 | struct Nested4 |
| 179 | { |
| 180 | struct InlineArray5 Field1; |
| 181 | uint16_t Field2; |
| 182 | }; |
| 183 | |
| 184 | struct Nested5 |
| 185 | { |
| 186 | uint16_t Field1; |
| 187 | struct InlineArray5 Field2; |
| 188 | }; |
| 189 | |
| 190 | struct Nested6 |
| 191 | { |
| 192 | struct InlineArray4 Field1; |
| 193 | uint32_t Field2; |
| 194 | }; |
| 195 | |
| 196 | struct Nested7 |
| 197 | { |
| 198 | uint32_t Field1; |
| 199 | struct InlineArray4 Field2; |
| 200 | }; |
| 201 | |
| 202 | struct Nested8 |
| 203 | { |
| 204 | struct InlineArray4 Field1; |
| 205 | uint16_t Field2; |
| 206 | }; |
| 207 | |
| 208 | struct Nested9 |
| 209 | { |
| 210 | uint16_t Field1; |
| 211 | struct InlineArray4 Field2; |
| 212 | }; |
| 213 | |
| 214 | DLLEXPORT struct SingleByte EchoSingleByte(struct SingleByte value) |
| 215 | { |
| 216 | return value; |
| 217 | } |
| 218 | |
| 219 | DLLEXPORT struct SingleLong EchoSingleLong(struct SingleLong value) |
| 220 | { |
| 221 | return value; |
| 222 | } |
| 223 | |
| 224 | DLLEXPORT struct SingleFloat EchoSingleFloat(struct SingleFloat value) |
| 225 | { |
| 226 | return value; |
| 227 | } |
| 228 | |
| 229 | DLLEXPORT struct SingleDouble EchoSingleDouble(struct SingleDouble value) |
| 230 | { |
| 231 | return value; |
| 232 | } |
| 233 | |
| 234 | DLLEXPORT struct ByteAndFloat EchoByteAndFloat(struct ByteAndFloat value) |
| 235 | { |
| 236 | return value; |
| 237 | } |
| 238 | |
| 239 | DLLEXPORT struct LongAndFloat EchoLongAndFloat(struct LongAndFloat value) |
| 240 | { |
| 241 | return value; |
| 242 | } |
| 243 | |
| 244 | DLLEXPORT struct ByteAndDouble EchoByteAndDouble(struct ByteAndDouble value) |
| 245 | { |
| 246 | return value; |
| 247 | } |
| 248 | |
| 249 | DLLEXPORT struct DoubleAndByte EchoDoubleAndByte(struct DoubleAndByte value) |
| 250 | { |
| 251 | return value; |
| 252 | } |
| 253 | |
| 254 | DLLEXPORT struct PointerAndByte EchoPointerAndByte(struct PointerAndByte value) |
| 255 | { |
| 256 | return value; |
| 257 | } |
| 258 | |
| 259 | DLLEXPORT struct ByteAndPointer EchoByteAndPointer(struct ByteAndPointer value) |
| 260 | { |
| 261 | return value; |
| 262 | } |
| 263 | |
| 264 | DLLEXPORT struct ByteFloatAndPointer EchoByteFloatAndPointer(struct ByteFloatAndPointer value) |
| 265 | { |
| 266 | return value; |
| 267 | } |
| 268 | |
| 269 | DLLEXPORT struct PointerFloatAndByte EchoPointerFloatAndByte(struct PointerFloatAndByte value) |
| 270 | { |
| 271 | return value; |
| 272 | } |
| 273 | |
| 274 | DLLEXPORT struct ShortIntFloatIntPtr EchoShortIntFloatIntPtr(struct ShortIntFloatIntPtr value) |
| 275 | { |
| 276 | return value; |
| 277 | } |
| 278 | |
| 279 | DLLEXPORT struct TwoLongs EchoTwoLongs(struct TwoLongs value) |
| 280 | { |
| 281 | return value; |
| 282 | } |
| 283 | |
| 284 | DLLEXPORT struct TwoFloats EchoTwoFloats(struct TwoFloats value) |
| 285 | { |
| 286 | return value; |
| 287 | } |
| 288 | |
| 289 | DLLEXPORT struct TwoDoubles EchoTwoDoubles(struct TwoDoubles value) |
| 290 | { |
| 291 | return value; |
| 292 | } |
| 293 | |
| 294 | DLLEXPORT struct FourLongs EchoFourLongs(struct FourLongs value) |
| 295 | { |
| 296 | return value; |
| 297 | } |
| 298 | |
| 299 | DLLEXPORT struct FourDoubles EchoFourDoubles(struct FourDoubles value) |
| 300 | { |
| 301 | return value; |
| 302 | } |
| 303 | |
| 304 | DLLEXPORT struct InlineArray1 EchoInlineArray1(struct InlineArray1 value) |
| 305 | { |
| 306 | return value; |
| 307 | } |
| 308 | |
| 309 | DLLEXPORT struct InlineArray2 EchoInlineArray2(struct InlineArray2 value) |
| 310 | { |
| 311 | return value; |
| 312 | } |
| 313 | |
| 314 | DLLEXPORT struct InlineArray3 EchoInlineArray3(struct InlineArray3 value) |
| 315 | { |
| 316 | return value; |
| 317 | } |
| 318 | |
| 319 | DLLEXPORT struct InlineArray4 EchoInlineArray4(struct InlineArray4 value) |
| 320 | { |
| 321 | return value; |
| 322 | } |
| 323 | |
| 324 | DLLEXPORT struct InlineArray5 EchoInlineArray5(struct InlineArray5 value) |
| 325 | { |
| 326 | return value; |
| 327 | } |
| 328 | |
| 329 | DLLEXPORT struct InlineArray6 EchoInlineArray6(struct InlineArray6 value) |
| 330 | { |
| 331 | return value; |
| 332 | } |
| 333 | |
| 334 | DLLEXPORT struct Nested1 EchoNested1(struct Nested1 value) |
| 335 | { |
| 336 | return value; |
| 337 | } |
| 338 | |
| 339 | DLLEXPORT struct Nested2 EchoNested2(struct Nested2 value) |
| 340 | { |
| 341 | return value; |
| 342 | } |
| 343 | |
| 344 | DLLEXPORT struct Nested3 EchoNested3(struct Nested3 value) |
| 345 | { |
| 346 | return value; |
| 347 | } |
| 348 | |
| 349 | DLLEXPORT struct Nested4 EchoNested4(struct Nested4 value) |
| 350 | { |
| 351 | return value; |
| 352 | } |
| 353 | |
| 354 | DLLEXPORT struct Nested5 EchoNested5(struct Nested5 value) |
| 355 | { |
| 356 | return value; |
| 357 | } |
| 358 | |
| 359 | DLLEXPORT struct Nested6 EchoNested6(struct Nested6 value) |
| 360 | { |
| 361 | return value; |
| 362 | } |
| 363 | |
| 364 | DLLEXPORT struct Nested7 EchoNested7(struct Nested7 value) |
| 365 | { |
| 366 | return value; |
| 367 | } |
| 368 | |
| 369 | DLLEXPORT struct Nested8 EchoNested8(struct Nested8 value) |
| 370 | { |
| 371 | return value; |
| 372 | } |
| 373 | |
| 374 | DLLEXPORT struct Nested9 EchoNested9(struct Nested9 value) |
| 375 | { |
| 376 | return value; |
| 377 | } |
| 378 | |
| 379 | DLLEXPORT struct TwoLongs (uint64_t a, uint64_t b, uint64_t c, uint64_t d, uint64_t e, uint64_t f, struct TwoLongs value) |
| 380 | { |
| 381 | return value; |
| 382 | } |
| 383 | |
| 384 | DLLEXPORT struct TwoLongs (uint64_t a, uint64_t b, uint64_t c, uint64_t d, uint64_t e, struct TwoLongs value) |
| 385 | { |
| 386 | return value; |
| 387 | } |
| 388 | |
| 389 | DLLEXPORT struct DoubleAndByte (uint64_t a, uint64_t b, uint64_t c, uint64_t d, uint64_t e, uint64_t f, struct DoubleAndByte value) |
| 390 | { |
| 391 | return value; |
| 392 | } |
| 393 | |
| 394 | DLLEXPORT struct TwoDoubles (double a, double b, double c, double d, double e, double f, double g, double h, struct TwoDoubles value) |
| 395 | { |
| 396 | return value; |
| 397 | } |
| 398 | |
| 399 | DLLEXPORT struct TwoDoubles (double a, double b, double c, double d, double e, double f, double g, struct TwoDoubles value) |
| 400 | { |
| 401 | return value; |
| 402 | } |
| 403 | |
| 404 | DLLEXPORT struct DoubleAndByte (double a, double b, double c, double d, double e, double f, double g, double h, struct DoubleAndByte value) |
| 405 | { |
| 406 | return value; |
| 407 | } |
| 408 | |
| 409 | DLLEXPORT struct TwoDoubles (uint64_t a, uint64_t b, uint64_t c, uint64_t d, uint64_t e, uint64_t f, struct TwoDoubles value) |
| 410 | { |
| 411 | return value; |
| 412 | } |
| 413 | |
| 414 | DLLEXPORT struct DoubleAndByte (uint64_t a, uint64_t b, uint64_t c, uint64_t d, uint64_t e, struct DoubleAndByte value) |
| 415 | { |
| 416 | return value; |
| 417 | } |
| 418 | |
| 419 | DLLEXPORT struct TwoLongs (double a, double b, double c, double d, double e, double f, double g, double h, struct TwoLongs value) |
| 420 | { |
| 421 | return value; |
| 422 | } |
| 423 | |
| 424 | DLLEXPORT struct DoubleAndByte (double a, double b, double c, double d, double e, double f, double g, struct DoubleAndByte value) |
| 425 | { |
| 426 | return value; |
| 427 | } |
| 428 | |