在Windows RT ARM平台上的SQLite3中崩溃
Crash in SQLite3 on Windows RT ARM platform
我目前正在通过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的好例子。
更新:
事实证明,如果我包含原始 sqlite3.h/.c 文件绕过官方预编译的 .lib/.dll 文件,上面的代码会按预期工作。
SQLite3 团队告诉我确实存在问题。问题本身要么在SQLite3代码库中,要么在Microsoft MSVC编译器中,他们正在积极努力寻找解决方案。
事实证明,问题仅在启用优化时发生,罪魁祸首是/Og 开关。您可以暂时禁用构建优化来解决此问题。
相关文章:
- 当回溯以零开始时,如何调试崩溃
- 内联映射初始化的动态atexit析构函数崩溃
- 执行函数时导致崩溃的变量
- 程序崩溃并显示"std::out_of_range"错误
- CoInitialize()在单独的线程上崩溃而不返回
- 使用调试/崩溃报告将应用程序部署到客户端
- 为什么所有C++编译器都会崩溃或挂起此代码
- 为什么lambda在clang上崩溃而不是在gcc上崩溃
- 为什么我的多线程作业队列崩溃
- ExtractIconEx:可以工作,但偶尔会崩溃
- 无法在windows上使用mingw将sqlite3与c连接
- 为什么引用传递会导致此崩溃(C++)
- 试图创建流或fopen时程序崩溃
- 类对象数组的问题会导致崩溃
- 排序时无法执行交换操作.我做的时候它会崩溃.为什么
- 为什么要增加导致崩溃的指针
- 在虚幻引擎中删除NXOpen对象时崩溃
- 为什么它只打印双链接列表的第一个值,而我的程序却崩溃了
- 应用程序崩溃并显示"symbol _ZdlPvm, version Qt_5 not defined in file libQt5Core.so.5 with link time reference"
- 在Windows RT ARM平台上的SQLite3中崩溃