Sign in to follow this  

Code only used if DLL is found?

This topic is 4613 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
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

This topic is 4613 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.

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