c++ - Windows RT ARM 平台上的 SQLite3 崩溃

标签 c++ sqlite windows-8 arm

我目前使用的是通过 Visual Studio 2012 中的扩展和更新管理器下载的 SQLite3 v3.7.14。当我为 Win32 编译时它可以工作,但是当我在 ARM 上编译和运行时它没有。每当我尝试设置 sqlite3_temp_directory 时它就会崩溃。我觉得我正在关注这里的文档 ( http://www.sqlite.org/c3ref/temp_directory.html )。

void init()
{
    // Set the temporary directory for sqlite prior to opening the database
    LPCWSTR zPath = Windows::Storage::ApplicationData::Current->TemporaryFolder->Path->Data();
    char zPathBuf[MAX_PATH + 1];
    memset(zPathBuf, 0, sizeof(zPathBuf));
    WideCharToMultiByte(CP_UTF8, 0, zPath, -1, zPathBuf, sizeof(zPathBuf), NULL, NULL);
    sqlite3_temp_directory = sqlite3_mprintf("%s", zPathBuf); // CRASHES HERE ON WINRT

    auto localDataPath = Windows::Storage::ApplicationData::Current->LocalFolder->Path;
    std::wstring path(localDataPath->Data());
    path += L"\\database.sql";

    sqlite3_open16(path.c_str(), &m_DB);
}

我想知道我是否遗漏了什么?我不确定如何调试这个,也找不到任何在 WinRT 上使用 SQLite3 或正确使用 sqlite3_temp_directory 的好例子。

更新:

事实证明,如果我绕过官方预编译的 .lib/.dll 文件包含原始 sqlite3.h/.c 文件,上述代码将按预期工作。

最佳答案

SQLite3 团队通知我确实有问题。问题本身要么在 SQLite3 代码库中,要么在 Microsoft MSVC 编译器中,他们正在积极努力寻找解决方案。

事实证明,问题仅在启用优化时出现,主要原因是/Og 开关。您可以暂时禁用构建优化来解决此问题。

关于c++ - Windows RT ARM 平台上的 SQLite3 崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12559528/

相关文章:

c++ - 读取加密的用户名/密码

c++ protected 指向同一类的指针成员和访问权限

python - 递归地将pymysql Comment对象转换为树

android - Room - 何时初始化数据库以及如何通过应用程序生命周期访问它

c++ - 在 C++ 中覆盖具有不同返回类型的方法

c++ - 在已排序的双向链表中插入节点

sql - 在sqlite中获取上一个/下一个记录

windows - 使用 Windows 8 专业版作为我的开发机器

c# - 程序可以在Win 7上运行,但不能在Win 8上运行

html - 使页面在 Windows 8 应用程序中可滚动