Public Group

# Where to place SDL.dll and other libs?

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

## Recommended Posts

I have a problem; my code uses lot of SDL libraries and thus, my folder is full of them. Looks very messy. Is there a way i can make a directory called ie 'libs' and put sdl.dll, sdl_image.dll and all other in that directory? What should i change in source?

##### Share on other sites
Afaik, this is difficult.
I found this: http://msdn.microsoft.com/en-us/library/ms686203.aspx
but it did not work for me.

##### Share on other sites
If you are using visual studio, I think you can just add a path to search for libraries in by going to the options/properties menu. Otherwise, I'm not sure - What IDE do you use?

##### Share on other sites
I am using code::blocks. Any solution?

##### Share on other sites
I'm assuming your talking about the directory that you would distribute to your end users which contains both your executable and any librarys it uses?

If so you could create a folder inside that directory and place all those files in the new directory and create a shortcut to the exe and place that in the top directory like so:

Game Folder:   |___ Files:   |      |___ Game.exe   |      |___ SDL.lib   |      |___ SDL_image.lib   |   |___ Game.lnk <---- Shortcut to ./Files/Game.exe

You could also just create an installer which places all the content, dlls and executables for your game in the Programs folder and place a shortcut on the desktop or the start menu.

A final way you might go about it, is to place all the dll's used in the Windows/System32 folder then you don't need to have them in the exe's directory altough when it comes to releasing your game you cant garentuee that the end user has the required libraries allready, so you will have to distribute them with the games executable anyway.

I would say the installer is the prefered method out of those three.

##### Share on other sites
Quote:
 Original post by cNoobA final way you might go about it, is to place all the dll's used in the Windows/System32 folder then you don't need to have them in the exe's directory altough when it comes to releasing your game you cant garentuee that the end user has the required libraries allready, so you will have to distribute them with the games executable anyway.

That is considered to be a bad solution. E.g. Game1 installs SDL version1 there and just works with this specific SDL version (for whatever reason there may be). Now Game2 overwrites the DLLs in the Windows/System32 folder and voila: Game1 won't work anymore. The other approach to have link in the game root folder sounds more sensible to me; that's how it's done for some commercial games as well, e.g. Stalker.

##### Share on other sites
Quote:
 Original post by Srbin013I have a problem; my code uses lot of SDL libraries and thus, my folder is full of them. Looks very messy. Is there a way i can make a directory called ie 'libs' and put sdl.dll, sdl_image.dll and all other in that directory? What should i change in source?

Short answer - no. It shouldn't really be much of a problem anyway, most games ship with a LOT of dlls in the executable folder. A quick glance at NWN2 shows well over fifteen DLLs, Civ4 has eight and Unreal 3 has well over fifteen.

Long answer - Yes, but its a lot of work and you need to be comfortable doing it. Get the source code for the libraries you are using, and compile them as part of your project. If you're using Visual Studio, you can create seperate projects for the different libraries. This is an easy way to combine all the SDL libraries into one simple DLL.

Also, most professional games use this method. All the external libraries that they depend on are added to the solution, which makes debugging a thousand times easier.

Did that make sense, or am I not explaning things well?

##### Share on other sites
Thx ppl, i guess i will have to live with that.

##### Share on other sites
Quote:
 Original post by Srbin013Thx ppl, i guess i will have to live with that.

I know, I'm kind of OCD about those things myself. Just don't think about it too much hehe

##### Share on other sites
How no to think? I am ex-amiga user, i could do that stuff i asked on amiga.

SDL_Lib=OpenLibrary("libsdir/sdl.library",0); (or like that)

and voala!

Sorry for trolling, couln't resist myself :)

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 15
• 14
• 46
• 22
• 27
• ### Forum Statistics

• Total Topics
634050
• Total Posts
3015242
×