linking a external static library into UEFI application


蒋国兵 <guobing.jiang@...>
 

I am working with a UEFI APPLICATION and am trying to link an externally built static library.
The static library is build with VS2019/2017, the same with my UEFI application.
I have attempted to use this syntax in a dedicated INF:
[Binaries]
LIB | gbaddLib.lib

But when I build my application, it always report link error 2001:
EdkLogger.debug(EdkLogger.DEBUG_8, "Threads [%s]" % ", ".join(Th.getName() for Th in threading.enumerate()))
c:\Users\guobing\workspace\UEFI\edk2-edk2-stable202011\BaseTools\Source\Python\build\build.py:199: DeprecationWarning: isSet() is deprecated, use is_set() instead
if ExitFlag.isSet():
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\Hostx86\x64\link.exe" /OUT:c:\users\guobing\workspace\uefi\edk2-edk2-stable202011\Build\GbApp\RELEASE_VS2017\X64\GbPkg\Application\GbApp\DEBUG\gbApp.dll /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4281 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:_ModuleEntryPoint /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=.data @c:\users\guobing\workspace\uefi\edk2-edk2-stable202011\Build\GbApp\RELEASE_VS2017\X64\GbPkg\Application\GbApp\OUTPUT\static_library_files.lst
gbApp.lib(main.obj) : error LNK2001: unresolved external symbol gbadd
c:\users\guobing\workspace\uefi\edk2-edk2-stable202011\Build\GbApp\REL
EASE_VS2017\X64\GbPkg\Application\GbApp\DEBUG\gbApp.dll : fatal error LNK1120: 1 unresolved externals
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\Hostx86\x64\link.exe"' : return code '0x460'
Stop.

Is there any additional requirements, that I may miss, when building my applicaiton or my static library.