Thanks for that. I do have a simple stdcall dll that sits in between my VB6 ActiveX dll and sqlite3.dll This does nil else than simply things like this:
SQLITE3_STDCALL_API int __stdcall sqlite3_stdcall_column_count(sqlite3_stmt* pStmt) { return sqlite3_column_count(pStmt); } So, that takes care of your point 1 and this works all perfectly fine. > I think that using the AddressOf keyword won't really work with SQLite in this context due to mismatched calling conventions (cdecl versus stdcall). This is interesting as I do use VB6 AddressOf to pass the pointer of the UDF to SQLite. It must be working OK though as I pass this pointer again via that stdcall dll and also because there is no problem with only one UDF in a SQL statement. I have to mention that I do use a .tlb that sits in between my ActiveX dll and that stdcall dll. I don't think this is the problem, because it makes no difference if I do instead plain Declares in my VB6 dll. I take it your .net dll handles UDF's fine, even when there are 2 in one SQL statement? I agree it is all tricky, but apart from this particular UDF problem all runs perfectly fine (both data producing SQL and non-data producing SQL) and very fast as well. See also my reply to Mr Hipp. RBS On Thu, Dec 24, 2015 at 9:56 PM, Joe Mistachkin <sflists at mistachkin.com> wrote: > > It's been quite a long while since I used vb6 on a regular basis; however, > integrating with native DLLs can be quite tricky for several reasons: > > 1. It cannot call any native function that does not conform to the > "stdcall" calling convention. > > 2. It has a very Win32-centric way of marshalling data types. > > 3. Using 64-bit integers at all is somewhat tricky, IIRC. You may need > to use a ByVal structure to pass them and I cannot remember how to use them > as returned values. > > 4. Properly declaring and calling (e.g. using the ByVal keyword > strategically) is critically important. Another issue is ANSI versus > Unicode (UCS2 for COM) versus UTF-8 (SQLite) and knowing when to use which > and how to convert between them (or marshal them). > > 5. Doing inbound callbacks to VB6 code is very very tricky, mostly due to > [apartment] threading issues. I think that using the AddressOf keyword > won't really work with SQLite in this context due to mismatched calling > conventions (cdecl versus stdcall). > > I'll try looking for my old VB6 SQLite integration code when I have some > spare cycles. > > Sent from my iPhone > > > On Dec 24, 2015, at 11:10 AM, Bart Smissaert <bart.smissaert at gmail.com> > wrote: > > > > OK, thanks > > I don't use any of 1 to 3, I only use the standard SQLite functions such > as > > sqlite3_open_v2, sqlite3_prepare16_v2, sqlite3_step, sqlite3_bind, > > sqlite3_column, sqlite3_create_function_v2, sqlite3_finalize, > > sqlite3_reset, sqlite3_result, sqlite3_value and qlite3_close. > > So, in that case I don't need sqlite3_free, sqlite3_malloc or > > sqlite3_realloc, I take it. > > Given that I don't use theses it then likely that my problem is to do > with > > a buffer overwrite? > > > > RBS > > > > > > > >> On Thu, Dec 24, 2015 at 8:35 PM, Richard Hipp <drh at sqlite.org> wrote: > >> > >>> On 12/24/15, Bart Smissaert <bart.smissaert at gmail.com> wrote: > >>> My question is if there is ever any need in this situation to run one > of > >>> the sqlite3 memory procedures, that is > >>> sqlite3_free, sqlite3_malloc or sqlite3_realloc? > >>> Currently I am not using this anywhere in my VB6 code. > >>> Should I? > >> > >> Cases when you might use sqlite3_malloc(): > >> > >> (1) You are using on of SQLite's built-in memory allocators. The > >> built-in memory allocators are disabled unless you use certain > >> compile-time options. And even then, you have to turn them on using > >> sqlite3_config(SQLITE_CONFIG_HEAP,...). > >> > >> (2) You need to use sqlite3_msize(). > >> > >> (3) If you use sqlite3_mprintf(), then sqlite3_free() must be used to > >> release the string once you are done with it. > >> > >> Otherwise, there is no real advantage to using SQLite memory allocator > >> interface in place of your standards system memory allocator. > >> > >> -- > >> D. Richard Hipp > >> drh at sqlite.org > >> _______________________________________________ > >> sqlite-users mailing list > >> sqlite-users at mailinglists.sqlite.org > >> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users > > _______________________________________________ > > sqlite-users mailing list > > sqlite-users at mailinglists.sqlite.org > > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users > > > _______________________________________________ > sqlite-users mailing list > sqlite-users at mailinglists.sqlite.org > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users >