I am developing a shim, and am facing a problem (or it might be a defect in
the sample shims I have seen so far):

- When I receive a call to my xOpen function, the 3rd parameter is a
sqlite3_file* type.

- As per the sqlite3PagerOpen function, the size of the memory allocated to
this pointer is ROUND8(pVfs->szOsFile).

- On Windows, the value of szOsFile is sizeof(winFile) + sizeof(myFile).

- As per the sample shims, in my xOpen handler, I must typecast the
sqlite3_file* value to myFile*

Does this mean that winFile and myFile are now overlapping at the same
memory location?

For example: if sqlite3_file is defined as:

struct sqlite3_file {

const struct sqlite3_io_methods *pMethods;  /* Methods for an open file */

};
and winFile is defined as:

struct winFile {

  const sqlite3_io_methods *pMethod; /*** Must be first ***/

  sqlite3_vfs *pVfs;      /* The VFS used to open this file */

};

and myFile is defined as (taken from multiplex sample shim):

struct myFile {
  sqlite3_file base;              /* Base class - must be first */
  multiplexGroup *pGroup;         /* The underlying group of files */

};

Wouldn't winFile::pVfs and myFile::pGroup be at the same location in memory?
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to