1 /***********************************************************************
3 * This software is part of the ast package *
4 * Copyright (c) 1997-2010 AT&T Intellectual Property *
5 * and is licensed under the *
6 * Common Public License, Version 1.0 *
7 * by AT&T Intellectual Property *
9 * A copy of the License is available at *
10 * http://www.opensource.org/licenses/cpl1.0.txt *
11 * (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) *
13 * Information and Software Systems Research *
17 * Glenn Fowler <gsf@research.att.com> *
19 ***********************************************************************/
33 * dlopen() wrapper that properly initializes LIBPATH
34 * with the path of the dll to be opened
36 * 2009-04-15 -- if ld.so re-checked the env this would work ...
40 dllopen(const char* name
, int mode
)
54 nenv
[0] = nenv
[1] = 0;
59 olibpath
= getenv(info
->env
);
60 if (base
= strrchr(name
, '/'))
71 path
= sfprints("%-.*s%s%c%s=%-.*s%s%s", len
, dir
, base
, 0, info
->env
, len
, dir
, olibpath
? ":" : "", olibpath
? olibpath
: "");
72 environ
[0] = path
+ strlen(path
) + 1;
73 dll
= dlopen(path
, mode
);
84 * dlopen() wrapper -- waiting for prestidigitaions
88 dllopen(const char* name
, int mode
)
90 return dlopen(name
, mode
);