[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Implicit linking of local .so
Alright, I think I figured it out. As usual, the solution is pretty simple,
but couldn't be arrived at without trying everything else first.
Once a library has been loaded into memory, any subsequently
loaded modules will bind directly to the image in memory, rather
than going back out to the disk and trying to load the library again.
This is true on all the platforms I tried (Linux, Win32, BeOS). So
I moved my application into a shared library (as simple as changing
a couple compile flags and renaming main). Then I wrote a stub
program which loads all the required support libraries using dlopen().
Once the libraries are loaded, it loads the main game library and
calls the renamed main(), which then implicitly binds to the support
library images which are already in memory, and voila! The system
loader takes care of everything. It's only a few minutes more work
than writing the shell script, I can autodetect the executable path
at runtime so it will still work if the user moves the files, and I don't
have to worry about what shells the system has available. Plus its
completely portable to other systems (so far, what I wouldn't give
for a Mac to develop on!).
Thanks for the help everyone.
Jason
379