+ if (test_type == DSO_REFTEST) {
+# ifdef DSO_DLFCN
+ /*
+ * 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 (!shlib_sym(cryptolib, DSO_DSOBYADDR, &dso_dsobyaddr_sym.sym)
+ || !shlib_sym(cryptolib, DSO_FREE, &dso_free_sym.sym)) {
+ printf("Unable to load crypto dso symbols\n");
+ return 1;
+ }
+
+ DSO_dsobyaddr = (DSO_dsobyaddr_t)dso_dsobyaddr_sym.func;
+ DSO_free = (DSO_free_t)dso_free_sym.func;
+
+ {
+ DSO *hndl;
+ /* use known symbol from crypto module */
+ if ((hndl = DSO_dsobyaddr((void (*)())ERR_get_error, 0)) != NULL) {
+ DSO_free(hndl);
+ } else {
+ printf("Unable to obtain DSO reference from crypto symbol\n");
+ return 1;
+ }
+ }
+# endif /* DSO_DLFCN */
+ }
+