Sqlite 3.7.10和Delphi中的静态链接

Mak*_*see 4 delphi sqlite linker

最新版本的Sqlite(3.7.10)想要链接__msize函数,既然Delphi内存管理器无法报告内存块的大小,我不得不介绍一个hack(d5兼容)

function __msize(p: pointer): Cardinal;cdecl;
begin
  Result:=PInteger(integer(p)-4)^-6;
end;
Run Code Online (Sandbox Code Playgroud)

Sqlite(定义?)或Delphi中是否有其他解决方案可以修复此问题,因此不会使用任何未记录的功能.

Arn*_*hez 8

在源代码的#15195行附近,注释以下行:

/*
** Windows systems have malloc_usable_size() but it is called _msize()
*/
#if !defined(HAVE_MALLOC_USABLE_SIZE) && SQLITE_OS_WIN
# define HAVE_MALLOC_USABLE_SIZE 1
# define malloc_usable_size _msize
#endif
Run Code Online (Sandbox Code Playgroud)

/*
** Windows systems have malloc_usable_size() but it is called _msize()
#if !defined(HAVE_MALLOC_USABLE_SIZE) && SQLITE_OS_WIN
# define HAVE_MALLOC_USABLE_SIZE 1
# define malloc_usable_size _msize
#endif
*/
Run Code Online (Sandbox Code Playgroud)

它将禁用SQLite3 malloc的内存重用,并将依赖于更好的FastMM4 reallocmem()实现.

请参阅此提交,例如我们的SQLite3静态链接的开源实现.

附加信息:

我认为我们已经在3.7.11中解决了这个问题,正如本次提交所述:SQLITE_WITHOUT_MSIZE将添加一个新的全局符号,并且能够在不改变其内容的情况下构建合并源代码,只需设置适当的SQLITE_WITHOUT_MSIZE限定.同时,最容易评论上述内容.