Arc Forumnew | comments | leaders | submitlogin
2 points by jmatt 6096 days ago | link | parent

Ok here is a more specific question.

Given this C and ffi declaration:

  ;int sqlite3_exec(
  ;  sqlite3*,                                  /* An open database */
  ;  const char *sql,                           /* SQL to be evaluted */
  ;  int (*callback)(void*,int,char**,char**),  /* Callback function */
  ;  void *,                                    /* 1st argument to callback */
  ;  char **errmsg                              /* Error msg written here */
  ;);

  ;sqlite3_exec
  (cdef sqlite3-exec "sqlite3_exec" cint (cptr cstring cfptr cptr cstring))
Why is this call to it seg faulting (for details on parameters see load code above):

  (sqlite3-exec sqlite3 sqltxt (topcb) sqltxtptr sqlerrormsg)
Does this work for anyone else? Is there a problem with my parameter delcaration / setup?

Thanks ~



1 point by sacado 6094 days ago | link

On the Arc level, it works perfectly well for me (no error, no segfault). But, when I try to (manually, with vi) open the db file (the "test" file), it's empty. Existing, but empty. I don't know why yet.

There's one thing that seems strange to me in the above declaration : char errmsg should not be declared as a cstring : it is a pointer to a string. I guess it should be declared as a cptr. I'll investigate more deeply later, when I'll find enough time...

-----

2 points by jmatt 6093 days ago | link

Yeah that is definitely a problem. I will work on this again tonight and see if I can get somewhere.

-----

2 points by sacado 6096 days ago | link

I'll try that & see if I can help you...

-----

1 point by jmatt 6096 days ago | link

Awesome, much appreciated.

-----