+ if (test_type == DSO_REFTEST) {
+# ifdef DSO_DLFCN
+ DSO_dsobyaddr_t myDSO_dsobyaddr;
+ DSO_free_t myDSO_free;
+
+ /*
+ * This is resembling the code used in ossl_init_base() and
+ * OPENSSL_atexit() to block unloading the library after dlclose().
+ * We are not testing this on Windows, because it is done there in a
+ * completely different way. Especially as a call to DSO_dsobyaddr()
+ * will always return an error, because DSO_pathbyaddr() is not
+ * implemented there.
+ */
+ if (!TEST_true(shlib_sym(cryptolib, "DSO_dsobyaddr", &symbols[0].sym))
+ || !TEST_true(shlib_sym(cryptolib, "DSO_free",
+ &symbols[1].sym)))
+ goto end;
+
+ myDSO_dsobyaddr = (DSO_dsobyaddr_t)symbols[0].func;
+ myDSO_free = (DSO_free_t)symbols[1].func;
+
+ {
+ DSO *hndl;
+ /* use known symbol from crypto module */
+ if (!TEST_ptr(hndl = myDSO_dsobyaddr((void (*)())ERR_get_error, 0)))
+ goto end;
+ myDSO_free(hndl);
+ }
+# endif /* DSO_DLFCN */
+ }
+