• source navigation  • diff markup  • identifier search  • freetext search  • 

Sources/ucode/tests/custom/17_lib_ffi/25_calling_conventions

  1 Calling conventions specify how functions receive arguments and return values.
  2 On x86 platforms, ucode supports `__attribute__((stdcall))`, `__attribute__((fastcall))`,
  3 and `__attribute__((cdecl))` syntax. The keywords `__stdcall`, `__fastcall`, etc. also work.
  4 
  5 -- Testcase --
  6 {%
  7 import * as ffi from 'ffi';
  8 
  9 // Test all calling convention syntaxes in a single multi-line cdef
 10 ffi.cdef(`
 11 __attribute__((stdcall)) int atoi(const char *);
 12 __attribute__((fastcall)) long strtol(const char *, char **, int);
 13 __attribute__((cdecl)) size_t strlen(const char *);
 14 __stdcall int abs(int);
 15 `);
 16 
 17 // All declarations parsed successfully
 18 print("Calling conventions: OK\n");
 19 -- End --
 20 
 21 -- Expect stdout --
 22 Calling conventions: OK
 23 -- End --

This page was automatically generated by LXR 0.3.1.  •  OpenWrt