我正在编译使用 Microsoft Dmf 框架 (DmfK.lib) 的内核模式驱动程序
在上次 Visual Studio 更新之后,出现了一些奇怪的链接器错误:
EmulationTargetPDO.obj : error LNK2019: unresolved external symbol __stdio_common_vswprintf referenced in function _vsnwprintf_l
Utilities.lib(savedata.obj) : error LNK2001: unresolved external symbol __stdio_common_vswprintf
DmfK.lib(DmfUtility.obj) : error LNK2001: unresolved external symbol __stdio_common_vswprintf
EmulationTargetPDO.obj : error LNK2019: unresolved external symbol __stdio_common_vsprintf referenced in function _vsnprintf_l
DmfK.lib(DmfCore.obj) : error LNK2001: unresolved external symbol __stdio_common_vsprintf
DmfK.lib(Dmf_CrashDump.obj) : error LNK2019: unresolved external symbol __stdio_common_vsprintf_s referenced in function _vsprintf_s_l
Run Code Online (Sandbox Code Playgroud)
这是我使用的软件和套件版本(显示在 VS“关于”窗口中):
我是swift的新手,我在处理非托管CFString(或NSString)的指针时遇到了一些困难.我正在研究一个暗示使用UnsafeMutablePointer?>的CoreMIDI项目,你可以在这个函数中看到:
func MIDIObjectGetStringProperty(_ obj: MIDIObjectRef,
_ propertyID: CFString!,
_ str: UnsafeMutablePointer<Unmanaged<CFString>?>) -> OSStatus
Run Code Online (Sandbox Code Playgroud)
我的问题是我想分配一个缓冲区来接收属性的内容(_str),然后调用上面的函数,最后使用println在控制台中打印内容.
目前我写了这个:
// Get the first midi source (I know it exists)
var midiEndPoint : Unmanaged<MIDIEndpointRef> = MIDIGetSource(0)
//C reate a "constant" of 256
let buf = NSMutableData(capacity: 256)
// Allocate a string buffer of 256 characters (I'm not even sure this does what I want)
var name = UnsafeMutablePointer<Unmanaged<CFString>?>(buf!.bytes)
// Call the function to fill the string buffer with the display name of the midi device …Run Code Online (Sandbox Code Playgroud) 我使用一些 NVIDIA 管理库功能在我的应用程序中生成指标。
每 1 秒我在一个线程中调用 nvmlDeviceGetMemoryInfo(),几分钟后,在 Visual Studio 的输出中,我可以读取数百个:
'MyApp.exe' (Win32): Loaded 'C:\Windows\System32\nvapi64.dll'.
'MyApp.exe' (Win32): Unloaded 'C:\Windows\System32\nvapi64.dll'
...
'MyApp.exe' (Win32): Loaded 'C:\Windows\System32\nvapi64.dll'.
'MyApp.exe' (Win32): Unloaded 'C:\Windows\System32\nvapi64.dll'
'MyApp.exe' (Win32): Loaded 'C:\Windows\System32\nvapi64.dll'.
'MyApp.exe' (Win32): Unloaded 'C:\Windows\System32\nvapi64.dll'
...
Run Code Online (Sandbox Code Playgroud)
来自 NVML 的其他函数,如 nvmlDeviceGetCount()、nvmlDeviceGetHandleByIndex()、nvmlDeviceGetClockInfo() 或 nvmlDeviceGetUtilizationRates() 不会产生这种实时加载/卸载 nvapi64.dll。
是否可以避免卸载此 dll,以使其可用于我下次调用 nvmlDeviceGetMemoryInfo() ?
编辑 :
我调用这个函数来检索这样的 gpu 内存统计信息:
nvmlMemory_t memInfo;
if (nvmlDeviceGetMemoryInfo(device, &memInfo) == NVML_SUCCESS) {
this->gpuMemUsed = memInfo.used;
this->gpuMemTotal = memInfo.total;
}
Run Code Online (Sandbox Code Playgroud)
我在 Debug 和 Release 中看到这些输出行,每次我调用 nvmlDeviceGetMemoryInfo() 时都会有几个 Loaded nvapi64.dll / Unloaded nvapi64.dll …