Sign in to follow this  
Srbin013

Where to place SDL.dll and other libs?

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 this post


Link to post
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 this post


Link to post
Share on other sites
Quote:
Original post by cNoob
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.

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 this post


Link to post
Share on other sites
Quote:
Original post by Srbin013
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?


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 this post


Link to post
Share on other sites
Quote:
Original post by Srbin013
Thx 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 this post


Link to post
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 :)

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