Hi!
i found a problem while playing with TalkFFI generation of MySQL( yes,
thats probably not the path we are going to take but i am doing init to
learn).
The generation throws a problem with the following struct.
typedef struct my_collation_handler_st
{
my_bool (*init)(struct charset_info_st *, void *(*alloc)(size_t));
/* Collation routines */
int (*strnncoll)(struct charset_info_st *,
const uchar *, size_t, const uchar *, size_t, my_bool);
int (*strnncollsp)(struct charset_info_st *,
const uchar *, size_t, const uchar *, size_t,
my_bool);
size_t (*strnxfrm)(struct charset_info_st *c,
uchar *a, size_t g, const uchar *b, size_t h);
size_t (*strnxfrmlen)(struct charset_info_st * aa, size_t bb);
my_bool (*like_range)(struct charset_info_st *,
const char *s, size_t s_length,
pchar w_prefix, pchar w_one, pchar w_many,
size_t res_length,
char *min_str, char *max_str,
size_t *min_len, size_t *max_len);
int (*wildcmp)(struct charset_info_st *,
const char *str,const char *str_end,
const char *wildstr,const char *wildend,
int escape,int w_one, int w_many);
int (*strcasecmp)(struct charset_info_st *, const char *, const char *);
uint (*instr)(struct charset_info_st *,
const char *b, size_t b_length,
const char *s, size_t s_length,
my_match_t *match, uint nmatch);
/* Hash calculation */
void (*hash_sort)(struct charset_info_st *cs, const uchar *key, size_t
len,
ulong *nr1, ulong *nr2);
my_bool (*propagate)(struct charset_info_st *cs, const uchar *str, size_t
len);
} MY_COLLATION_HANDLER;
As you can see the struct has eleven fields which are functions pointers.
However, when we generate with TalkFFI it s fails, and we can see that the
struct generate is the following:
an OrderedCollection(
#MySQLMySysH25Cb->'init'
#MySQLMySysH26Cb->'strnncoll'
#MySQLMySysH26Cb->'strnncollsp'
{#NBInt32. {'NBInt32 *'->'arg1'}}->'size_t'
#MySQLMySysH27Cb->'like_range'
#MySQLMySysH28Cb->'wildcmp'
#MySQLMySysH6Cb->'strcasecmp'
#MySQLMySysH29Cb->'instr'
#MySQLMySysH30Cb->'hash_sort'
#MySQLMySysH31Cb->'propagate'
)
The generate struct have only ten fields and the fourth is wrongly
generated. Instead of the two fields strnxfrm and strnxfrmlen , it
generates garbage.
We were with guille debugging and playing with the struct declaration with
not much results.
Thanks for any help rochi and guille.