I'm sure there's something simple I'm missing. I'm running from the Visual Studio Command Prompt.
1 Answer
By linking with the right import library.
Add advapi32.lib to the command line, cl.exe should recognize it as a library to link to.
-
Thanks. After doing that Depends.exe still shows it as a delay-load library. Is there any way to force it to load and initialize apart from calling a function in it? Jul 20, 2009 at 19:35
-
Not that I know. But why would you want to link explicitly to advapi32 if you do not use it ? Jul 20, 2009 at 19:51
-
I'm trying to work around a bug caused by calling it from within dllMain. It's not initialized properly yet so it is failing. Jul 20, 2009 at 19:54
-
1Well, generally speaking, you should not use delay-loaded libraries or LoadLibrary them from DllMain (see microsoft.com/whdc/driver/kernel/DLL_bestprac.mspx). Jul 20, 2009 at 19:57
-
1How to link with this
Advapi32.lib
library? P.S., I just found it here:cl t.cpp /link /DEFAULTLIB:advapi32.lib
linking error LNK2019– userFeb 23, 2020 at 0:21