>I had the bright idea yesterday of trying to use an extension module in >Windows. I found myself a bit confused, and the messages and >documentation were not as helpful as they might have been. I suspect I >had a 32/64 bit mismatch in one case, and that sqlite3 wasn't compiled >with extension-module support, but I was unable to prove that to >myself.
... >1. The architecture of an executable file, x86 or x64. dumpbin -- comes with the dev kit editbin -- same source, lets you edit some of the flags, such as 32-bit clean (LargeAddressAware) >2. The compilation options used when building binaries posted on the >download page. In particular, SQLITE_OMIT_LOAD_EXTENSION. sqlite> pragma compile_options; DEBUG ENABLE_COLUMN_METADATA ENABLE_FTS3 ENABLE_FTS3_PARENTHESIS ENABLE_FTS4 ENABLE_LOAD_EXTENSION ENABLE_MEMORY_MANAGEMENT ENABLE_RTREE ENABLE_STAT4 MAX_MMAP_SIZE=0x80000000 MAX_SCHEMA_RETRY=50 SOUNDEX TEMP_STORE=2 THREADSAFE=1 WIN32_MALLOC of course, that is for the shell I build, not the one on the download pages. running "pragma compile_options" as an SQL statement will return the options which were used to build the engine queried. >3. The name of the module not found. Presumably this is the one you tried to load. However, not necessarily. You need depends (the tool, not the diaper) to ensure that the module can be loaded together with all its dependencies since if some dependency is missing, the system will just fail to load the module without being able to tell you why. Depends will also show you the import/export and symbol tables of the modules (whether EXE or DLL) that you run it against (plus all the pre-loaded dependencies). Importantly make sure you are exporting "C" names. Mangled names won't work, nor will ordinals. >4. The name of the procedure not found. Presumably the procedure you tried to call. I know, not necessarily helpful. Since depends can show you the import/export tables for your module, it will probably help here too, to ensure that the symbol you think should be exported actually is. >Things I would like to verify here: > >5. The 32-bit windows sqlite3 shell supports extensions? See pragma compile_options; >6. The above messages come from the OS, and result from LoadLibrary >failing? IOW, I didn't build a proper extension, windowswise? The error code comes from the OS, the message is either the default or and internal one generated to describe the failure code. The OS returned error codes are, shall we say, not very diagnostic. Errors such as "The service could not be started because the file was not found" are common in Windows. Telling you the name of the service and the name of the file (and where it expected to find it) would be useful, but I think rule 1 prevails "Everything Useful is Prohibited". As a matter of fact, that particular error message can be completely bogus because it is possible that the file was found and the service started, and then it crashed during module load initialization (ie, in the loader) before the loader was able to "complete" the load/link and relocate operations. >7. How does the shell behave if SQLITE_OMIT_LOAD_EXTENSION is used? >Obviously the function would fail, but I wonder if ".load" is dropped >from the help and parseable syntax? >8. Where is $HOME in windows, wrt .sqliterc? I tried %appdata%; that >didn't seem to be it. I kinda doubt it. It will use the standard windows load order for modules: first the toilet (windows\system directories) then the current directory, then the path. If a path is specified in the load call, then only that location is checked (but dependencies will follow the default windows load order). Some dependencies may be loaded from new-fangled magical locations, and only from those locations, even if the module is located in the toilet or the current directory. This is a Windows Feature (that can be really annoying, since you cannot just put the correct dependencies in the correct places, you have to recite the appropriate magical incantations to get windows to recognize them -- though this often applies to runtime libraries not your modules (ie, MSVCRTxx.DLL)). BTW, it is *much* easier to use the compiler in real (command line) mode rather than the hooey-gooey. The compiler is called CL and it can give you its help with "cl -?". There is a silly batch file somewhere in the VS install directories that set all the environment variables properly so you can then use a real editor and compile from the command line. --- Theory is when you know everything but nothing works. Practice is when everything works but no one knows why. Sometimes theory and practice are combined: nothing works and no one knows why. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users