Sign in to follow this  
Zipster

[MSVC] Delay load hell

Recommended Posts

Zipster    2365
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...

Share this post


Link to post
Share on other sites
SiCrane    11839
I could have sworn you were supposed to specify /DELAYLOAD with the name of the DLL rather than the name of the .lib.

Share this post


Link to post
Share on other sites
Zipster    2365
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]

Share this post


Link to post
Share on other sites
Red Ant    471
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this