#include <string.h>
#include <errno.h>
#ifdef VMS
+#pragma message disable DOLLARID
#include <lib$routines.h>
#include <libfisdef.h>
#include <stsdef.h>
#else
#pragma message disable DOLLARID
-static int vms_load(DSO *dso, const char *filename);
+static int vms_load(DSO *dso);
static int vms_unload(DSO *dso);
static void *vms_bind_var(DSO *dso, const char *symname);
static DSO_FUNC_TYPE vms_bind_func(DSO *dso, const char *symname);
static int vms_unbind_func(DSO *dso, char *symname, DSO_FUNC_TYPE symptr);
static int vms_init(DSO *dso);
static int vms_finish(DSO *dso);
-#endif
static long vms_ctrl(DSO *dso, int cmd, long larg, void *parg);
+#endif
+static char *vms_name_converter(DSO *dso);
static DSO_METHOD dso_meth_vms = {
"OpenSSL 'VMS' shared library method",
NULL, /* unbind_var */
NULL, /* unbind_func */
#endif
- vms_ctrl,
+ NULL, /* ctrl */
+ vms_name_converter,
NULL, /* init */
NULL /* finish */
};
return(&dso_meth_vms);
}
-static int vms_load(DSO *dso, const char *filename)
+static int vms_load(DSO *dso)
{
+#if 0
DSO_VMS_INTERNAL *p;
const char *sp1, *sp2; /* Search result */
return(0);
}
return(1);
+#else
+ /* See the comments lower down in the vms_name_converter
+ * "implementation" :-) */
+ please_break_compilation();
+ return(bother_richard);
+#endif
}
/* Note that this doesn't actually unload the shared image, as there is no
0, flags);
}
-static void *vms_bind_sym(DSO *dso, const char *symname)
+void vms_bind_sym(DSO *dso, const char *symname, void **sym)
{
DSO_VMS_INTERNAL *ptr;
- void *sym = 0;
int status;
int flags = LIB$M_FIS_MIXEDCASE;
struct dsc$descriptor_s symname_dsc;
+ *sym = NULL;
symname_dsc.dsc$w_length = strlen(symname);
symname_dsc.dsc$b_dtype = DSC$K_DTYPE_T;
if((dso == NULL) || (symname == NULL))
{
DSOerr(DSO_F_VMS_BIND_VAR,ERR_R_PASSED_NULL_PARAMETER);
- return(NULL);
+ return;
}
if(sk_num(dso->meth_data) < 1)
{
DSOerr(DSO_F_VMS_BIND_VAR,DSO_R_STACK_ERROR);
- return(NULL);
+ return;
}
ptr = (DSO_VMS_INTERNAL *)sk_value(dso->meth_data,
sk_num(dso->meth_data) - 1);
if(ptr == NULL)
{
DSOerr(DSO_F_VMS_BIND_VAR,DSO_R_NULL_HANDLE);
- return(NULL);
+ return;
}
if(dso->flags & DSO_FLAG_UPCASE_SYMBOL) flags = 0;
- status = do_find_symbol(ptr, &symname_dsc, &sym, flags);
+ status = do_find_symbol(ptr, &symname_dsc, sym, flags);
if(!$VMS_STATUS_SUCCESS(status))
{
errstring_dsc.dsc$b_class = DSC$K_CLASS_S;
errstring_dsc.dsc$a_pointer = errstring;
+ *sym = NULL;
+
status = sys$getmsg(status, &length, &errstring_dsc, 1, 0);
if (!$VMS_STATUS_SUCCESS(status))
" in ", ptr->filename,
": ", errstring);
}
- return(NULL);
+ return;
}
- return(sym);
+ return;
}
static void *vms_bind_var(DSO *dso, const char *symname)
{
- return vms_bind_sym(dso, symname);
+ void *sym = 0;
+ vms_bind_sym(dso, symname, &sym);
+ return sym;
}
static DSO_FUNC_TYPE vms_bind_func(DSO *dso, const char *symname)
{
- return (DSO_FUNC_TYPE)vms_bind_sym(dso, symname);
+ DSO_FUNC_TYPE sym = 0;
+ vms_bind_sym(dso, symname, (void **)&sym);
+ return sym;
}
-static long vms_ctrl(DSO *dso, int cmd, long larg, void *parg)
- {
- if(dso == NULL)
- {
- DSOerr(DSO_F_VMS_CTRL,ERR_R_PASSED_NULL_PARAMETER);
- return(-1);
- }
- switch(cmd)
- {
- case DSO_CTRL_GET_FLAGS:
- return dso->flags;
- case DSO_CTRL_SET_FLAGS:
- dso->flags = (int)larg;
- return(0);
- case DSO_CTRL_OR_FLAGS:
- dso->flags |= (int)larg;
- return(0);
- default:
- break;
- }
- DSOerr(DSO_F_VMS_CTRL,DSO_R_UNKNOWN_COMMAND);
- return(-1);
- }
+static char *vms_name_converter(DSO *dso)
+ {
+ /* Implementation note: on VMS is it preferable to do real conversions
+ * here, or to actually have it performed in-line with the bind calls
+ * (given that VMS never actually does a load except implicitly within
+ * the bind functions). Another note: normally (eg. dlfcn), the
+ * DSO_load call will either load, put the loaded filename into the DSO
+ * (which marks it effectively as "read-only"), and return success - or
+ * it will fail. VMS needs to work out what to do - otherwise DSO_load
+ * will always succeed, but leave the DSO looking unloaded (because the
+ * loaded_filename will be NULL still) and then real loading (and
+ * setting of loaded_filename) will only happen during the first bind
+ * call (which should have error checking anyway to prevent you calling
+ * it on an "unloaded" DSO - thus giving VMS *serious* grief). Richard,
+ * what do you think? Is it worth having DSO_load() try to find and pin
+ * itself to a library file (and populate loaded_filename) even though
+ * it's unecessary to actually do a load prior to the first bind call?
+ * I leave it to you ... :-) */
+ deliberately_break_compilation_here();
+ return(1);
+ }
#endif /* VMS */