The Mono project at http://www.go-mono.com has a Sqlite data provider
written in C#. You can compile this on Windows for use with Microsoft
.Net (as opposed to Mono) but it doesn't work as-is. I made the
following changes to get it working:

Added the Cdecl attribute to the PInvoke declarations:

[DllImport("sqlite", CallingConvention = CallingConvention.Cdecl)]

Changed the declaration of the callback function:

internal unsafe int SqliteCallback (IntPtr o, int argc, sbyte **argv,
sbyte **colnames)

Changed the SqliteCommand.ExecuteReader method so that the callback
delegate is a class variable rather than local to the method.

Finally, followed the instructions given by Jan Kotas for changing the
delegate to Cdecl. It was in a post to
Microsoft.public.dotnet.framework.interop, thread called "Callback
function using C calling convention"; Google will find it.

I don't know if *all* these steps are necessary, but after doing the
above I've been able to use the provider OK. Of course there are other
.Net providers out there; I think all the others use managed C++. I'm
currently reviewing several of these and wanted to get the Mono one
working. 

Not sure if this has been posted before, but it took me a while to work
out so might help someone.

Tim

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to