Changes for static build.

This commit is contained in:
Jaroslav Kysela 2001-10-24 14:14:11 +00:00
parent caa8d5372e
commit 27472b56a6
44 changed files with 362 additions and 158 deletions

View file

@ -1,6 +1,6 @@
EXTRA_LTLIBRARIES=libhwdep.la
libhwdep_la_SOURCES = hwdep.c hwdep_hw.c
libhwdep_la_SOURCES = hwdep.c hwdep_hw.c hwdep_symbols.c
noinst_HEADERS = hwdep_local.h
all: libhwdep.la

View file

@ -48,6 +48,9 @@ static int snd_hwdep_open_conf(snd_hwdep_t **hwdep,
snd_config_iterator_t i, next;
const char *lib = NULL, *open_name = NULL;
int (*open_func)(snd_hwdep_t **, const char *, snd_config_t *, snd_config_t *, int) = NULL;
#ifndef PIC
extern void *snd_hwdep_open_symbols(void);
#endif
void *h;
if (snd_config_get_type(hwdep_conf) != SND_CONFIG_TYPE_COMPOUND) {
if (name)
@ -102,20 +105,18 @@ static int snd_hwdep_open_conf(snd_hwdep_t **hwdep,
open_name = buf;
snprintf(buf, sizeof(buf), "_snd_hwdep_%s_open", str);
}
h = dlopen(lib, RTLD_NOW);
if (h) {
if ((err = snd_dlsym_verify(h, open_name, SND_DLSYM_VERSION(SND_HWDEP_DLSYM_VERSION))) < 0) {
dlclose(h);
goto _err;
}
open_func = dlsym(h, open_name);
}
#ifndef PIC
snd_hwdep_open_symbols();
#endif
h = snd_dlopen(lib, RTLD_NOW);
if (h)
open_func = snd_dlsym(h, open_name, SND_DLSYM_VERSION(SND_HWDEP_DLSYM_VERSION));
if (!h) {
SNDERR("Cannot open shared library %s", lib);
err = -ENOENT;
} else if (!open_func) {
SNDERR("symbol %s is not defined inside %s", open_name, lib);
dlclose(h);
snd_dlclose(h);
err = -ENXIO;
}
_err:

View file

@ -27,6 +27,11 @@
#include <sys/ioctl.h>
#include "hwdep_local.h"
#ifndef PIC
/* entry for static linking */
const char *_snd_module_hwdep_hw = "";
#endif
#define SNDRV_FILE_HWDEP "/dev/snd/hwC%iD%i"
#define SNDRV_HWDEP_VERSION_MAX SNDRV_PROTOCOL_VERSION(1, 0, 0)
@ -137,7 +142,6 @@ int snd_hwdep_hw_open(snd_hwdep_t **handle, const char *name, int card, int devi
return 0;
}
SND_DLSYM_BUILD_VERSION(_snd_hwdep_hw_open, SND_HWDEP_DLSYM_VERSION);
int _snd_hwdep_hw_open(snd_hwdep_t **hwdep, char *name,
snd_config_t *root ATTRIBUTE_UNUSED,
snd_config_t *conf, int mode)
@ -178,3 +182,4 @@ int _snd_hwdep_hw_open(snd_hwdep_t **hwdep, char *name,
return -EINVAL;
return snd_hwdep_hw_open(hwdep, name, card, device, mode);
}
SND_DLSYM_BUILD_VERSION(_snd_hwdep_hw_open, SND_HWDEP_DLSYM_VERSION);