On Mon, Aug 25, 2008 at 02:30:44PM -0700, Brown, Daniel wrote:
> I'm attempting to wrap SQLite with Managed C++ and I'm getting some
> compiler warnings as the compiler/linker is have trouble finding the
> declaration of the structure 'sqlite3_stmt', I've tried looking for it
> manually but I can't find it either all I can find is a typedef on line
> 2569 of slite3.h.  This isn't enough to stop the CLR compiler form
> complaining, I had a similar warning with the structure 'sqlite3' but
> including sqlite3Int.h resolved that warning as the structure is defined
> there, however tracking down the header file that defines 'sqlite3_stmt'
> seems to be leading no where...

This:

typedef struct foo * foo_t;

without a corresponding definition of struct foo is perfectly valid in C.

So is:

struct foo;
typedef struct foo * foo_t;

It effectively declares a pointer type which is distinct from any other
pointer type while at the same time not exposing any details of struct
foo to applications.  Heck, there need not even be a struct foo -- the
library could just cast foo_t values to something else.

This is a very common technique in C API design.

A wrapper tool that insists that you provide a definition for struct foo
is broken, but you can always get around it by adding a bogus
definition, like:

struct foo {
        void    *bar;
};

That should work because the wrapper shouldn't have to know any of the
private details of struct foo in this case.

Substitute 'sqlite3_stmt' for 'foo'.

Nico
-- 
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to