Commit graph

21 commits

Author SHA1 Message Date
Andy Polyakov
c6cb42e4fb "Relax" prototype and rename DSO_global_lookup_func to DSO_global_lookup. 2006-01-02 08:59:20 +00:00
Andy Polyakov
68b64fb610 Add DSO_global_lookup_func implementation. See commentary in dso_lib.c
for further details.
2005-12-30 22:53:59 +00:00
Andy Polyakov
21ac2b964b Eliminate gcc -pedantic warnings. 2005-06-09 21:41:44 +00:00
Andy Polyakov
79e1dd65ab Allow for dso load by explicit path on HP-UX. 2005-06-09 20:52:24 +00:00
Andy Polyakov
7ed876533a New function, DSO_pathbyaddr, to find pathname for loaded shared object
by an address within it. Tested on Linux, Solaris, IRIX, Tru64, Darwin,
HP-UX, Win32, few BSD flavors...
2005-06-05 18:13:38 +00:00
Lutz Jänicke
4309c4ad46 Third argument to shl_load() is "long address", not a pointer.
(Didn't influence functionality, as on HP-UX 32bit the NULL pointer
is a 32bit 0-value and thus is identical to the required 0L.)

PR: 443
2003-01-08 08:27:50 +00:00
Richard Levitte
cbecb3ac37 There's an ongoing project to bring some kind of path selection
mechanism to the ENGINE framework.  This means there there are going
to be new functionality for the DSO part, and ultimately some way of
merging two file specifications together.

This commit places the merging code into the repository.  It's
currently not used anywhere, and hasn't been tested at all.  It may be
full of errors, including syntactical ones.  Those will be fixed as
promptly as possible.
2002-07-15 15:35:40 +00:00
Richard Levitte
acf60ef707 At least for the two common Unixly DSO loading methods, include the
system error in the error text.
2001-11-15 18:24:42 +00:00
Richard Levitte
f3229ee19a Use one address consistently. 2001-07-05 10:20:07 +00:00
Geoff Thorpe
b7b6c047ca This change to the "dl", "dlfcn", and "win32" DSO_METHODs adds the filename
or symbol name to the error stack in the event a load or bind operation
failed.
2001-04-25 22:40:55 +00:00
Richard Levitte
e06433d9ba shl_load() also needs to load along a path given through an
environment variable, SHLIB_PATH.  This change makes that possible.
2000-11-07 11:25:26 +00:00
Richard Levitte
551e5990d2 On HP-UX, at least when shl_* are used, the libraries have the
extension .sl instead of .so.
2000-10-26 18:42:35 +00:00
Richard Levitte
d9efa3616a For the operating systems where it matters, it is sometimes good to
translate library names by only adding ".so" to them without
prepending them with "lib".  Add the flag DSO_FLAG_NAME_TRANSLATION_EXT_ONLY
for that purpose.
2000-10-26 18:30:34 +00:00
Geoff Thorpe
51c8dc37dd This changes the behaviour of the DSO mechanism for determining an
appropriate filename translation on the host system. Apart from this point,
users should also note that there's a slight change in the API functions
too. The DSO now contains its own to-be-converted filename
("dso->filename"), and at the time the DSO loads the "dso->loaded_filename"
value is set to the translated form. As such, this also provides an impicit
way of determining if the DSO is currently loaded or not. Except, perhaps,
VMS .... :-)

The various DSO_METHODs have been updated for this mechanism except VMS
which is deliberately broken for now, Richard is going to look at how to
fit it in (the source comments in there explain "the issue").

Basically, the new callback scheme allows the filename conversion to
(a) be turned off altogether through the use of the
    DSO_FLAG_NO_NAME_TRANSLATION flag,
(b) be handled in the default way using the default DSO_METHOD's converter
(c) overriden per-DSO by setting the override callback
(d) a mix of (b) and (c) - eg. implement an override callback that;
    (i) checks if we're win32 "if(strstr(dso->meth->name, "win32"))..."
        and if so, convert "blah" into "blah32.dll" (the default is
	otherwise to make it "blah.dll").
    (ii) default to the normal behaviour - eg. we're not on win32, so
         finish with (return dso->meth->dso_name_converter(dso,NULL)).
(e) be retried a number of times by writing a new DSO_METHOD where the
    "dso_load()" handler will call the converter repeatedly. Then the
    custom converter could use state information in the DSO to suggest
    different conversions or paths each time it is invoked.
2000-10-26 17:38:59 +00:00
Richard Levitte
e9a583aa26 Pointer error corrected 2000-10-22 12:47:01 +00:00
Geoff Thorpe
75a382bd90 None of the DSO_METHOD's were handling anything except generic messages.
These are now processed inside DSO_ctrl() itself.
2000-10-08 22:36:49 +00:00
Geoff Thorpe
e9a68cfbc3 Currently the DSO_METHOD interface has one entry point to bind all
"symbols" including functions (of all prototypes( and variables. Whilst
casting any function type to another violates ANSI C (I believe), it is
a necessary evil in shared-library APIs. However, it is quite
conceivable that functions in general and data symbols could very well
be represented differently to each other on some systems, as Bodo said;

> Since the function/object distinction is a lot more likely to be
> important on real-life platforms supporting DSO *and* it can be quite
> easily done *and* it will silence compilers that don't like
> assignments from void pointers to function pointer variables, why
> not do it?

I agree. So this change splits the "dso_bind" handler in DSO_METHOD
into "dso_bind_var" and "dso_bind_func". Similarly the exported
function DSO_bind() has been split in two. I've also put together
changes for the various DSO_METHOD implementations, but so far only
DSO_dlfcn() has been tested. BTW: The prototype for dso_bind had been
a bit strange so I've taken the opportunity to change its shape (in
both variations).

Also, the README has been updated - particularly with a note about
using customised native name-translation for shared libraries (and that
you can't do it yet).
2000-06-16 10:45:36 +00:00
Geoff Thorpe
ebbaebf784 This case in the "dso_unload" handlers should not be reported as an error -
if a DSO_load(NULL,...) operation fails, it will have to call DSO_free() on
the DSO structure it created and that will filter through to this "unload"
call.

If the stack size is "< 1", then the library never actually loaded. To keep
things clean higher up, I'll treat this as a vacuous case without an error.
It makes the error stack easier to follow real world cases, and the error
this ignores was only useful for catching bugs in internal code, not
mismatched calls from applications (which should be handled in the generic
DSO layer).
2000-04-25 08:37:12 +00:00
Geoff Thorpe
b9e6391582 This change facilitates name translation for shared libraries. The
technique used is far from perfect and alternatives are welcome.
Basically if the translation flag is set, the string is not too
long, and there appears to be no path information in the string,
then it is converted to whatever the standard should be for the
DSO_METHOD in question, eg;
    blah --> libblah.so   on *nix, and
    blah --> blah.dll     on win32.

This change also introduces the DSO_ctrl() function that is used
by the name translation stuff.
2000-04-19 21:45:17 +00:00
Geoff Thorpe
51175595b3 Constification, and a silly mistake in the comments. 2000-04-06 14:54:54 +00:00
Geoff Thorpe
8f4fac7f96 This is a set of startup code for the DSO support, it's not yet linked into
the build process (an upcoming commit no doubt), and is very much *new*
code - what that means is that it compiles ok - usually. It certainly
doesn't mean it runs well or even properly yet. Please don't muck round
with this unless you're looking to help out and hunt bugs. :-)

Currently this code doesn't have any support for controlling the "load"
behaviour (eg. paths, filename translations, etc). That'll be handled
using DSO_ctrl() and various flags, once we work out a sensible set of
flags.
2000-04-04 21:57:11 +00:00