Advertisement Jump to content
Sign in to follow this  
storage

Code only used if DLL is found?

This topic is 4982 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm trying to make a small application that does various things, but only if a specific DLL exists. Example code:
SDL_Surface *LoadImage(string filename)
{
    SDL_Surface *tmpsurface;
    
    if (DLLFound("SDL_image.dll"))
    {
        tmpsurface = IMG_Load(filename.c_str());
    } else {
        tmpsurface = SDL_LoadBMP(filename.c_str());
    }
    
    return tmpsurface;
}
But the I will still need SDL_image.dll to start the application, since the .lib is linked. Any way around this? Thanks in advance!

Share this post


Link to post
Share on other sites
Advertisement
You'll need to dynanically link with the DLL instead of staticly linking with the dll's lib, i don't have the details to hand at the moment but a google should find details, else im sure someone will be along soon with more info :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!