On Thu, 18 Mar 2004 16:01:39 -0500
"Clark, Chris" <[EMAIL PROTECTED]> wrote:
> > -----Original Message-----
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> > Sent: Tuesday, March 16, 2004 11:58 PM
> > To: [EMAIL PROTECTED]
> > Subject: Re: [sqlite] SQLite for Win32 TCHAR
> > 
> > 
> > So finally Ticket 239 http://www.sqlite.org/cvstrac/tktview?tn=239,2
> > will be fixed soon, after 1 year the ticket was submit? (by adding 'A'
> > to all file handling API in OS_WIN)
> 
> If you do that you break the WinCE port. WinCE only has the wide versions (but we
>have char and wide char). That's why the previuos posts have mentioned
>mbstowcs()/wcstombs().
> 
> Chris

OK, WinCE doesn't have CreateFileA symbol in its binary from the
beginning.

There will be 2 different scenarios for SQLite to adapt itself
to Windows overall.

1) Separate OS_WIN to OS_WINNT, OS_WIN9X, OS_WINCE, and
maintain different SQLite binaries for them as ports.

2) Put ASCII/wide version of those APIs side-by-side in os.c
of SQLite, like sqliteOsOpenReadWriteA and
sqliteOsOpenReadWriteW, and add user interfaces as sqlite_openA
and sqlite_openW, then put CreateFileA and CreateFileW (CreateFileW,
not CreateFile, is present as a symbol in WinCE binary as listed in
http://www.xs4all.nl/~itsme/projects/xda/wince-systemcalls.html, 
right? ) in each versions, just like WindowsNT itself does. This way
is what I suggested in the last paragraph of Ticket 239 comment of
1 year before.

http://www.sqlite.org/cvstrac/tktview?tn=239,2

"Another way is, add to SQLite its own ANSI/Unicode(UCS-2) version
APIs as Windows does, in Windows SQLite build. For example "open" is
translated in sqlite.h to openA/openW which exists in dll. Fortunately
SQLite has os.c as abstraction filter for its body, several changes in
os.c will be sufficient."

For sqlite.h,

#ifdef UNICODE
#define sqlite_open sqlite_openW
#else
#define sqlite_open sqlite_openA
#endif

this translation is sufficient, as you won't remove UNICODE symbol
in Windows Embedded development.

Win95 has CreateFileA (if you have installed Microsoft Unicode Layer
to Win9X it also has CreateFileW), WinNT has both CreateFileA and
CreateFileW, and WinCE has only CreateFileW. In current SQLite dll
binary at http://www.hwaci.com/sw/sqlite/sqlitedll.zip contains only
CreateFileA symbol as you can see it with Dependency Walker.

Performance-wise for WinNT, when it takes CreateFileA it internally
translates ASCII arguments to wide and passes it to CreateFileW, so
it's recommended that you use Unicode filenames consistently in
WinNT platforms.

By the way, please don't confuse the argument above with TCHAR
support all over SQLite, because SQLite won't support UTF-16 until
SQLite 3.0 as its storable data. And I don't like simple ASCII/wide
implicit translation wrapper to be incorporated in SQLite since it
becomes unwanted overhead. Here I only talk about TCHAR filename
and abstraction of file-handling interfaces.

-- KL


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

Reply via email to