+static inline fnptr load_sym(lt_dlhandle handle, const char *module, const char *symbol) {
+ char *buffer, *ch;
+ size_t buflen;
+ fnptr res;
+
+ res = lt_dlsym_fn(handle, symbol);
+ if (res)
+ return res;
+
+ /* As the .la files might have been cleansed from the system, we should
+ * try with the ltdl prefix as well. */
+
+ buflen = strlen(symbol) + strlen(module) + strlen("_LTX_") + 1;
+ buffer = pa_xmalloc(buflen);
+ assert(buffer);
+
+ strcpy(buffer, module);
+
+ for (ch = buffer;*ch != '\0';ch++) {
+ if (!isalnum(*ch))
+ *ch = '_';
+ }
+
+ strcat(buffer, "_LTX_");
+ strcat(buffer, symbol);
+
+ res = lt_dlsym_fn(handle, buffer);
+
+ pa_xfree(buffer);
+
+ return res;
+}
+