Max Vlasov wrote:
> They had static variant implemented with msvcrt linked, to remove
> the dependency yourself you have to implement the following functions
>
> _malloc,_realloc,_free,_memset,_strncmp,_memmove,_memcpy,_strlen,_qsort,_memcmp,_localtime
malloc/realloc/free are not needed if SQLITE_WIN32_MALLOC is defined
(which is a good idea anyway because the Windows functions are faster
than Borland's nowadays).
If you compile with BCC 5.5, most of these functions can simply be
extracted from its runtime library (i.e., extract the modules ftol,
_ftoul, _ll, memcmp, memcpy, memmove, memset, qsort, strlen, and strncmp
from the cw32.lib file with tlib, and then link with these .obj files).
You also need a variable named __turboFloat (which is used only to link
floating-point initialization code, which is already done by Delphi):
var
__turboFloat: Integer;
... and the function localtime(), which can simply be ported from
SQLite's Windows CE localtime() emulation:
type
time_t = Longint;
P_time_t = ^time_t;
struct_tm = record
tm_sec: Integer;
tm_min: Integer;
tm_hour: Integer;
tm_mday: Integer;
tm_mon: Integer;
tm_year: Integer;
tm_wday: Integer;
tm_yday: Integer;
tm_isdst: Integer;
end;
P_struct_tm = ^struct_tm;
var
y: struct_tm;
function _localtime(t: P_time_t): P_struct_tm; cdecl;
var
uTm, lTm: FILETIME;
pTm: SYSTEMTIME;
t64: Int64;
begin
t64 := t^;
t64 := (t64 + 11644473600)*10000000;
uTm.dwLowDateTime := t64;
uTm.dwHighDateTime:= t64 shr 32;
FileTimeToLocalFileTime(uTm, lTm);
FileTimeToSystemTime(lTm, pTm);
y.tm_year := pTm.wYear - 1900;
y.tm_mon := pTm.wMonth - 1;
y.tm_wday := pTm.wDayOfWeek;
y.tm_mday := pTm.wDay;
y.tm_hour := pTm.wHour;
y.tm_min := pTm.wMinute;
y.tm_sec := pTm.wSecond;
Result := @y;
end;
Regards,
Clemens
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users