1
0
mirror of https://github.com/lxsang/antd-lua-plugin synced 2025-01-03 21:08:22 +01:00
antd-lua-plugin/lib/ffi/example/lib.c

34 lines
593 B
C
Raw Normal View History

2019-04-30 20:09:07 +02:00
#include <stdio.h>
2019-05-03 13:17:45 +02:00
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)
2019-04-30 20:09:07 +02:00
{
2019-05-01 22:06:48 +02:00
printf("%s: '%f' '%d' '%c'\n", msg, num, sint, c);
2019-05-03 13:17:45 +02:00
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;
2019-04-30 20:09:07 +02:00
}
2019-05-03 13:17:45 +02:00
void test_string(char* buff, const char* a)
{
sprintf(buff,"you say %s", a);
printf("%s\n", buff);
}