[MSVC] Delay load hell

Started by
2 comments, last by Red Ant 13 years, 11 months ago
In the past, our company has used Bink for all our PC titles. However we're now working on a game that isn't going to have any fancy in-game video, so we need to remove our Bink dependency from our graphics library. However we're also working on a few other titles that require Bink and share common core libraries, so we can't just remove it entirely. The easiest solution is to delay-load the Bink DLL, which will remove the dependency in my project while still allowing us to use Bink in the other projects, and not require any major code changes or special integration instructions. However I can't for the life of me get the delay loading to work. After moving the Bink DLL to the delay load section in the linker settings, I get this: LINK : warning LNK4199: /DELAYLOAD:binkw32.lib ignored; no imports found from binkw32.lib Which is completely bogus, because a few lines later I get a slew of unresolved external errors related to Bink functions (I even confirmed that the functions being imported by my application existed in the list of functions being exported from the Bink DLL using dumpbin). If I keep the Bink DLL as a regular dependency, everything links properly, but not only do I still get the LNK4199 warning but Bink still isn't set to delay load (confirmed through Dependency Walker and dumpbin). I thought that maybe I had to use #pragma comment in some capacity, but no luck there either. I'm basically at my wits end trying to find the right combination of linker settings. Neither Google nor MSDN turn up anything that works...
Advertisement
I could have sworn you were supposed to specify /DELAYLOAD with the name of the DLL rather than the name of the .lib.
Quote:Original post by SiCrane
I could have sworn you were supposed to specify /DELAYLOAD with the name of the DLL rather than the name of the .lib.

All I can say is: /facepalm myself for not reading closely enough.

That appears to have fixed things. I like how the linker fails to mention that I didn't give it a DLL [rolleyes]
Darn, I didn't know this possibility existed! *facepalms too* When faced with a similar problem a couple of years ago, I removed the .lib file from the linker options and then messed around with LoadLibrary() and GetProcAddress() to get at the functions. I wish I had known then that it could just be as simple as specifying the /DELAYLOAD flag to the linker. Hmpf.

This topic is closed to new replies.

Advertisement