Specify the delay in loading C # pragma dll in cpp file

I have a statically linked library that uses some functions from the dll that I need to delay loading. Therefore, in my executable properties, I added this dll to the Linker/Input/Delay Loaded DLLs . I cannot add this parameter in lib itself, since it does not have Linker properties Linker (because it is a static library)
So, whenever I use this library in another executable tool, I need to add the download load option again and again, which I want to avoid. I know there used to be a pragma for this

 #pragma comment(linker, "/DELAYLOAD:mydll.dll") 

However, this does not work for me because he says

 warning LNK4229: invalid directive '/DELAYLOAD:mydll.dll' encountered; ignored 

Is there any way besides LoadLibrary?

+7
c ++ visual-studio
source share
1 answer

Was there any kind of research on Google (I think, like you), since I am always interested in such questions. Obviously the link:

http://social.msdn.microsoft.com/Forums/vstudio/en-US/807606af-f7d7-4d9b-a9f3-062b23fddb2b/using-the-delayload-linker-switch-with-a-custom-dll

Unfortunately, this is from 2004 that β€œnine years old and some versions of VS before.

But it gets worse, I found this too:

http://bytes.com/topic/net/answers/280580-delayload-pragma-fixed-whidbey

who is late for a year and sounds very believable:

No, it never worked reliably. It was a mistake to resolve it in 6.0. One that we fixed later by adding a warning.

Ronald Laremans

Visual C ++ Team

I knew that next to your three sentences there is no other, otherwise.

+4
source share

All Articles