Closed Niwo04 closed 3 months ago
This smells like the dll not containing the symbols, or it not being marked as dllexport, or rust not finding it properly somehow... Does it happen without bindgen (just with the plain symbol declaration)? How does the function declarations look like in the header (is there any difference between them, like calling convention or something)?
I used dumpbin to check the lib file and this is the output:
PS C:\Users\janne_lnpq1lo\Desktop\test_lol\src> dumpbin /exports /symbols nvencodeapi.lib
Microsoft (R) COFF/PE Dumper Version 14.39.33523.0
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file nvencodeapi.lib
File Type: LIBRARY
COFF SYMBOL TABLE
000 010161BB ABS notype Static | @comp.id
001 00000000 SECT2 notype External | __IMPORT_DESCRIPTOR_nvEncodeAPI64
002 C0000040 SECT2 notype Section | .idata$2
003 00000000 SECT3 notype Static | .idata$6
004 C0000040 UNDEF notype Section | .idata$4
005 C0000040 UNDEF notype Section | .idata$5
006 00000000 UNDEF notype External | __NULL_IMPORT_DESCRIPTOR
007 00000000 UNDEF notype External | nvEncodeAPI64_NULL_THUNK_DATA
String Table Size = 0x5E bytes
COFF SYMBOL TABLE
000 010161BB ABS notype Static | @comp.id
001 00000000 SECT2 notype External | __NULL_IMPORT_DESCRIPTOR
String Table Size = 0x1D bytes
COFF SYMBOL TABLE
001 00000000 SECT2 notype External | nvEncodeAPI64_NULL_THUNK_DATA
String Table Size = 0x23 bytes
Exports
ordinal name
NvEncodeAPICreateInstance
NvEncodeAPIGetMaxSupportedVersion
Summary
D5 .debug$S
14 .idata$2
14 .idata$3
8 .idata$4
8 .idata$5
12 .idata$6
The functions are indeed missing, but why are they in the .h file when I can't use them. The docs say I should just link to the functions. What can I do to fix this?
Hmm, I'm honestly not sure, but I don't work on Windows generally, and that seems outside the scope of bindgen... I'd cross-check with other dlls or so? Or maybe you need to dlopen(). Maybe the dynamic library feature in bindgen can help with that?
I'm trying to generate bindings for the NVENC lib, but some functions cannot be linked for whatever reason.
Excerpt from nvEncodeAPI.h:
build.rs:
Excerpt from generated bindings:
main.rs:
My problem is that
NvEncodeAPICreateInstance
works perfectly fine, but when I include code involvingNvEncInitializeEncoder
I get the link error.I'm on Windows 10, my build tools are up to date and my rust toolchain is nightly-x86_64-pc-windows-msvc.