我试图使用Visual Studio构建lmdb,但出现以下错误:
mdb.obj:错误LNK2001:未解析的外部符号NtMapViewOfSection@40
mdb.obj:错误LNK2001:未解析的外部符号“NtClose@4”
mdb.obj:错误LNK2001:未解析的外部符号\u NtCreateSection@28
对于在代码中首次使用此函数,有以下注释:

/* We use native NT APIs to setup the memory map, so that we can
 * let the DB file grow incrementally instead of always preallocating
 * the full size. These APIs are defined in <wdm.h> and <ntifs.h>
 * but those headers are meant for driver-level development and
 * conflict with the regular user-level headers, so we explicitly
 * declare them here. Using these APIs also means we must link to
 * ntdll.dll, which is not linked by default in user code.
 */
NTSTATUS WINAPI
NtCreateSection(OUT PHANDLE sh, IN ACCESS_MASK acc,
  IN void * oa OPTIONAL,
  IN PLARGE_INTEGER ms OPTIONAL,
  IN ULONG pp, IN ULONG aa, IN HANDLE fh OPTIONAL);

如何在Visual Studio中链接ntdll.dll?我明白,那个问题很愚蠢,但我在几个小时内找不到解决办法。。

最佳答案

您可以在Visual Studio中与ntdll.lib链接。

关于c - 在Visual Studio中将项目与ntdll.dll链接,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/34062509/

10-11 16:03