1
0
mirror of https://github.com/lxsang/antd-lua-plugin synced 2024-12-28 18:38:20 +01:00
antd-lua-plugin/lib/ffi/example/lib.c
2019-05-03 13:17:45 +02:00

34 lines
593 B
C

#include <stdio.h>
typedef struct{
char a;
int b;
short c;
char d;
} inner_t;
typedef struct{
char a;
inner_t b;
int c;
char d;
} test_t;
char greet(const char* msg, float num, int sint, char c)
{
printf("%s: '%f' '%d' '%c'\n", msg, num, sint, c);
return 'A';
}
test_t test_struct(test_t data)
{
printf("data is '%c' '%c' '%d' '%d' '%c' '%d' '%c'\n", data.a, data.b.a, data.b.b, data.b.c, data.b.d, data.c, data.d);
return data;
}
void test_string(char* buff, const char* a)
{
sprintf(buff,"you say %s", a);
printf("%s\n", buff);
}