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=librawmidi.la
librawmidi_la_SOURCES = rawmidi.c rawmidi_hw.c
librawmidi_la_SOURCES = rawmidi.c rawmidi_hw.c rawmidi_symbols.c
noinst_HEADERS = rawmidi_local.h
all: librawmidi.la

View file

@ -74,6 +74,9 @@ static int snd_rawmidi_open_conf(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp
const char *lib = NULL, *open_name = NULL;
int (*open_func)(snd_rawmidi_t **, snd_rawmidi_t **,
const char *, snd_config_t *, snd_config_t *, int) = NULL;
#ifndef PIC
extern void *snd_rawmidi_open_symbols(void);
#endif
void *h;
if (snd_config_get_type(rawmidi_conf) != SND_CONFIG_TYPE_COMPOUND) {
if (name)
@ -128,20 +131,19 @@ static int snd_rawmidi_open_conf(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp
open_name = buf;
snprintf(buf, sizeof(buf), "_snd_rawmidi_%s_open", str);
}
h = dlopen(lib, RTLD_NOW);
if (h) {
if ((err = snd_dlsym_verify(h, open_name, SND_DLSYM_VERSION(SND_RAWMIDI_DLSYM_VERSION))) < 0) {
dlclose(h);
goto _err;
}
open_func = dlsym(h, open_name);
}
#ifndef PIC
snd_rawmidi_open_symbols();
#endif
h = snd_dlopen(lib, RTLD_NOW);
if (h)
open_func = snd_dlsym(h, open_name, SND_DLSYM_VERSION(SND_RAWMIDI_DLSYM_VERSION));
err = 0;
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

@ -29,7 +29,12 @@
#include "../control/control_local.h"
#include "rawmidi_local.h"
#define SNDRV_FILE_RAWMIDI "/dev/snd/midiC%iD%i"
#ifndef PIC
/* entry for static linking */
const char *_snd_module_rawmidi_hw = "";
#endif
#define SNDRV_FILE_RAWMIDI "/dev/snd/midiC%iD%i"
#define SNDRV_RAWMIDI_VERSION_MAX SNDRV_PROTOCOL_VERSION(2, 0, 0)
typedef struct {
@ -302,7 +307,6 @@ int snd_rawmidi_hw_open(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp,
return -ENOMEM;
}
SND_DLSYM_BUILD_VERSION(_snd_rawmidi_hw_open, SND_RAWMIDI_DLSYM_VERSION);
int _snd_rawmidi_hw_open(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp,
char *name, snd_config_t *root ATTRIBUTE_UNUSED,
snd_config_t *conf, int mode)
@ -348,4 +352,4 @@ int _snd_rawmidi_hw_open(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp,
return -EINVAL;
return snd_rawmidi_hw_open(inputp, outputp, name, card, device, subdevice, mode);
}
SND_DLSYM_BUILD_VERSION(_snd_rawmidi_hw_open, SND_RAWMIDI_DLSYM_VERSION);