sc_module_*() -> scdl_*()

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1946 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
nils 2004-10-18 21:35:24 +00:00
parent 3dacb2c626
commit d0de68566f
2 changed files with 18 additions and 12 deletions

View File

@ -23,6 +23,7 @@
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <opensc/scdl.h>
#define GET_SLOT_PTR(s, i) (&(s)->slot[(i)])
#define GET_PRIV_DATA(r) ((struct ctapi_private_data *) (r)->drv_data)
@ -243,20 +244,22 @@ static int ctapi_load_module(struct sc_context *ctx,
}
val = conf->name->data;
r = sc_module_open(ctx, &dlh, val);
if (r != SC_SUCCESS) {
dlh = scdl_open(val);
if (!dlh) {
sc_error(ctx, "Unable to open shared library '%s'\n", val);
return -1;
}
r = sc_module_get_address(ctx, dlh, (void **) &funcs.CT_init, "CT_init");
if (r != SC_SUCCESS)
funcs.CT_init = scdl_get_address(dlh, "CT_init");
if (!funcs.CT_init)
goto symerr;
r = sc_module_get_address(ctx, dlh, (void **) &funcs.CT_close, "CT_close");
if (r != SC_SUCCESS)
funcs.CT_close = scdl_get_address(dlh, "CT_close");
if (!funcs.CT_close)
goto symerr;
r = sc_module_get_address(ctx, dlh, (void **) &funcs.CT_data, "CT_data");
if (r != SC_SUCCESS)
funcs.CT_data = scdl_get_address(dlh, "CT_data");
if (!funcs.CT_close)
goto symerr;
mod = add_module(gpriv, val, dlh);
for (; list != NULL; list = list->next) {
int port;
@ -307,7 +310,7 @@ static int ctapi_load_module(struct sc_context *ctx,
return 0;
symerr:
sc_error(ctx, "Unable to resolve CT-API symbols.\n");
sc_module_close(ctx, dlh);
scdl_close(dlh);
return -1;
}

View File

@ -20,6 +20,7 @@
#ifdef HAVE_LOCALE_H
#include <locale.h>
#endif
#include <opensc/scdl.h>
/*
* We keep a global shared library handle here.
@ -181,8 +182,8 @@ sc_ui_get_func(sc_context_t *ctx, const char *name, void **ret)
if (!lib_name)
return 0;
r = sc_module_open(ctx, &sc_ui_lib_handle, lib_name);
if (r < 0) {
sc_ui_lib_handle = scdl_open(lib_name);
if (!sc_ui_lib_handle) {
sc_error(ctx,
"Unable to open user interface library %s\n",
lib_name);
@ -193,7 +194,9 @@ sc_ui_get_func(sc_context_t *ctx, const char *name, void **ret)
if (sc_ui_lib_handle == NULL)
return 0;
return sc_module_get_address(ctx, sc_ui_lib_handle, ret, name);
*ret = scdl_get_address(sc_ui_lib_handle, name);
return *ret ? SC_SUCCESS : SC_ERROR_UNKNOWN;
}
/*