My situation is a bit unique yes. My project is an add-on mod to existing
games(Quake4,Doom3,Enemy Territory,HL2 engine games). Mods never add
dependend files to the games executable directory, and I sure as heck don’t
want to be copying stuff to their system directory. If I could load the dlls
from a subdirectory of the game of my choice, such as from the folders that
I have business reading from, I’d be set. I’m spawning an SDL window from
within a mod of these games for debugging, visualization, etc. The normal
paths of loading dependencies aren’t very useful. I don’t want to add bloat
to their game executable folder, or add stuff to their system folders, or
PATH, etc. As I feel any good application should work, I want to keep all
its dependencies under its own folder. The mod itself is a dynamic library,
not an executable, so the normal loading rules of executable folder aren’t
useful. Since I don’t have control over the dll loading to that extent I’m
left with the option of modifying SDL so I can instead do the LoadLibrary
and GetProcAddress bit myself, rather than the default linking arrangement.
Hope that clarifies my situation.
It’s not always feasible or desirable to be adding dlls to the executable
folder. Consider writing a plugin for 3dsmax, or maya or whatever. Your
plugin is a DLL, loaded from a plugins folder somewhere, you want to use
SDL/OpenGL to bring up a render window to visualize. You’re left with the
same issue. Either your plugin requires the dependent libraries in the root
app folder with the executable, and you’re fine with that. It’s the same
situation. In many situations, we wouldn’t even have the option of writing
additional files to existing app folders, due to lack of permissions to the
app folder, probably even the windows folder. Is your installer going to
require admin access just so you can spew some dlls to these crappy folders?
Or would you prefer to keep all your stuff under the same folder?
Applications cramming their junk everywhere is how windows got its DLL hell
nickname.
The difference is that my ‘plugin’ for these games are set up to all load
from a central location(it’s a bot for fps games). For example, Quake4,
Doom3, HL2 mods, etc all load my plugin ‘bot’ dlls from a central location,
such as an installed c:\program files\omni-bot All files are contained
within this install folder. This obviously isn’t the individual game
folders, and it would be wasteful to put multiple copies of dependencies in
all supported game folders.
Ultimately it’s an easy problem to solve if the project is from the ground
up your own executable and self contained. Using this sort of dll linking in
plugins or other dlls is where the suckage starts, as plugins and such are
often loaded from alternate places than the exe location, and leave you
needing to spread your dependencies to somewhere else to get them to load.
I’m more in favor of a LoadLibrary, GetProcAddress based loading procedure
than spewing dependent dlls all over the users machine.
JOn 10/31/07, necronology at cox.net wrote:
“if you want to have an
install-free application, you just want to carry all your dll’s as a
resource
with your executable.”
That’s how it is anyway. Just have the dll in the folder that the exe is
in.
As for loading a dll off of the internet I think it’s a security issue of
old. There would be no file footprint on the hard drive. You could download
it to the hard drive and then load it pretty easy. Then the software
conventions come into play where coders are supposed to put their stuff in
their own folder if it’s for their program and in system area if it’s for
multiple programs. To be nice you are supposed to install the program so the
users can easily find and remove/uninstall
---- Andre Krause wrote:
Can you explain why SDL.dll needs to exist in a different location
than
the executable? You are asking how to accomplish something very
specific, but I have a feeling that understanding the overall goal
might
be more useful to finding a solution that works for you.
–ryan.
i have a similar desire, so i just answer before jeremy:
its a specific problem, yes, but it is rather a problem of bad support
by the
operating system. afaik windows seems to know only one way of
dynamically
loading a library (LoadLibrary from a file) - and thats very limited.
what about
loading dlls from a resource? what about loading dlls over the internet
to a
memory buffer and starting the dll from that place? why is such basic
stuff not
supported directly by some standard system library?
and its not hard to understand why one needs that. if you want to have
an
install-free application, you just want to carry all your dll’s as a
resource
with your executable. happily, my own little project is open source, so
i have
no problem with static linkage, and do not to do nasty unportable dll
stuff.
SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org