Commit 438c72ce authored by Jonathan Wilkes's avatar Jonathan Wilkes
Browse files

add hexmunger loading to the main loader. This is way simplified over the

hexloader external (which will consequently be removed). The interface
1. If any characters that were illegal in a C function name were in the
   given object name, we get a "hexmunged" symbol where each illegal
   character is replaced with a "0x%c" where "%c" is the hex representation
   of that illegal character.
2. If we have a "hexmunged" symbol, we search for a file by the newly munged
   name. Currently this is search in addition to the normal paths-- it could
   probably be searched instead of it but I'm not completely sure if there
   are any edge cases that would be affected by that.
3. If the file is found, the loader searches for a setup routine named
   "setup_hexmungedSymbol". If it's a tilde object, it searches for
   "setup_hexmungedSymbol_tilde". (Note: normal external libs search for

Caveat: a lot of the obviously ad-hoc code for handling this cases in the
        external libraries just uses an "#include" directive for the entire
        C file of the original object. E.g., mtx_0x2a.c just does
        #include "../src/mtx_mul.c" with an extra setup routine that just
        calls the original one.

        So if a patch or running instance has both the [mtx_*] _and_ the
        [mtx_mul] objects, two separate libraries which essentially the
        same code and "setup" symbol will get loaded. The same is true
        for the original hexloader. I haven't had time to study the loaders
        on all Pd's platforms to figure out what the side-effects are of
        this approach
parent f7617d4b
......@@ -165,6 +165,25 @@ static int sys_do_load_lib(t_canvas *canvas, const char *objectname,
if ((fd = sys_trytoopenone(path, filename, sys_dllextent2,
dirbuf, &nameptr, MAXPDSTRING, 1)) >= 0)
goto gotone;
/* for hexmunged binary external files, give it a shot
with the hexmunged name. This is a really ugly system
but we need it for all the legacy libraries that use
funky characters. (The only alternative is putting libdir
classes all in a single file and preloading, which is
even worse.
The hexmunger never worked for abstractions without recompiling,
so we don't and won't support hexmunged abstractions.
if (hexmunge)
if ((fd = sys_trytoopenone(path, symname+6, sys_dllextent,
dirbuf, &nameptr, MAXPDSTRING, 1)) >= 0)
goto gotone;
/* same, with the more generic sys_dllextent2 */
if ((fd = sys_trytoopenone(path, symname+6, sys_dllextent2,
dirbuf, &nameptr, MAXPDSTRING, 1)) >= 0)
goto gotone;
#ifdef ANDROID
/* Android libs have a 'lib' prefix, '.so' suffix and don't allow ~ */
char libname[MAXPDSTRING] = "lib";
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment