Where to place SDL.dll and other libs?

Started by
8 comments, last by Srbin013 15 years, 8 months ago
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?
Advertisement
Afaik, this is difficult.
I found this: http://msdn.microsoft.com/en-us/library/ms686203.aspx
but it did not work for me.
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?
I mean, why would you get your medical advice anywhere else?
I am using code::blocks. Any solution?
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.
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.
-----PARPG - open source isometric 2d old school RPG still looking for interested contributors
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?
Thx ppl, i guess i will have to live with that.
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

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 :)

This topic is closed to new replies.

Advertisement