* for the first and third parameters. Use DSO_up and DSO_free for
* subsequent reference count handling. Any flags passed in will be set
* in the constructed DSO after its init() function but before the
- * load operation. This will be done with;
- * DSO_ctrl(dso, DSO_CTRL_SET_FLAGS, flags, NULL); */
+ * load operation. If 'dso' is non-NULL, 'flags' is ignored. */
DSO *DSO_load(DSO *dso, const char *filename, DSO_METHOD *meth, int flags);
/* This function binds to a variable inside a shared library. */
goto err;
}
allocated = 1;
+ /* Pass the provided flags to the new DSO object */
+ if(DSO_ctrl(ret, DSO_CTRL_SET_FLAGS, flags, NULL) < 0)
+ {
+ DSOerr(DSO_F_DSO_LOAD,DSO_R_CTRL_FAILED);
+ goto err;
+ }
}
else
ret = dso;
DSOerr(DSO_F_DSO_LOAD,DSO_R_NO_FILENAME);
goto err;
}
- /* Bleurgh ... have to check for negative return values for
- * errors. <grimace> */
- if(DSO_ctrl(ret, DSO_CTRL_SET_FLAGS, flags, NULL) < 0)
- {
- DSOerr(DSO_F_DSO_LOAD,DSO_R_CTRL_FAILED);
- goto err;
- }
if(ret->meth->dso_load == NULL)
{
DSOerr(DSO_F_DSO_LOAD,DSO_R_UNSUPPORTED);