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

View File

@ -20,6 +20,7 @@
#ifdef HAVE_LOCALE_H #ifdef HAVE_LOCALE_H
#include <locale.h> #include <locale.h>
#endif #endif
#include <opensc/scdl.h>
/* /*
* We keep a global shared library handle here. * 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) if (!lib_name)
return 0; return 0;
r = sc_module_open(ctx, &sc_ui_lib_handle, lib_name); sc_ui_lib_handle = scdl_open(lib_name);
if (r < 0) { if (!sc_ui_lib_handle) {
sc_error(ctx, sc_error(ctx,
"Unable to open user interface library %s\n", "Unable to open user interface library %s\n",
lib_name); 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) if (sc_ui_lib_handle == NULL)
return 0; 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;
} }
/* /*