Skip to content

Commit c27f8d2

Browse files
committed
Support a special pathname syntax for apr_dso_load()/dlopen() so
that an APR app can open shared libraries that for whatever reason (e.g., libtool) have been stuffed in an archive. This special archive.a(dso.so) syntax is required for the way libtool likes to build shared libraries on AIX. dlopen() support for such a library requires that the RTLD_MEMBER flag be enabled. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@62582 13f79535-47bb-0310-9956-ffa450edef68
1 parent 4789d64 commit c27f8d2

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

dso/unix/dso.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,20 @@ APR_DECLARE(apr_status_t) apr_dso_load(apr_dso_handle_t **res_handle,
139139
void *os_handle = dlopen((char *)path, RTLD_NOW | RTLD_GLOBAL);
140140

141141
#else
142-
void *os_handle = dlopen(path, RTLD_NOW | RTLD_GLOBAL);
142+
int flags = RTLD_NOW | RTLD_GLOBAL;
143+
void *os_handle;
144+
#ifdef _AIX
145+
if (strchr(path + 1, '(') && path[strlen(path) - 1] == ')')
146+
{
147+
/* This special archive.a(dso.so) syntax is required for
148+
* the way libtool likes to build shared libraries on AIX.
149+
* dlopen() support for such a library requires that the
150+
* RTLD_MEMBER flag be enabled.
151+
*/
152+
flags |= RTLD_MEMBER;
153+
}
154+
#endif
155+
os_handle = dlopen(path, flags);
143156
#endif
144157
#endif /* DSO_USE_x */
145158

0 commit comments

Comments
 (0)