diff --git a/Makefile b/Makefile index adad318..248fec6 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ SRC = ${OBJ:.o=.c} PLACEBO_FLAGS = -fomit-frame-pointer -fstrength-reduce -funroll-loops -ffast-math ALL_CFLAGS = -O3 ${PLACEBO_FLAGS} -std=c99 -fPIC -Wall ${CFLAGS} ALL_LDFLAGS = -lm ${LDFLAGS} -SHARED_LDFLAGS = -nostartfiles -shared +SHARED_LDFLAGS = -shared PREFIX ?= /usr/local EXEC_PREFIX ?= ${PREFIX} diff --git a/crap_eq.c b/crap_eq.c index 93e98d1..c4ffcd6 100644 --- a/crap_eq.c +++ b/crap_eq.c @@ -26,6 +26,9 @@ typedef unsigned long ulong; #define BW_MIN 0.02 #define BW_MAX 8 +static int ready = 0; +void _init(); + LADSPA_PortDescriptor p_discs[PCOUNT]; LADSPA_PortRangeHint p_hints[PCOUNT]; const char *p_names[PCOUNT]; @@ -59,8 +62,10 @@ typedef struct { LADSPA_Data run_adding_gain; } eq_t; -const LADSPA_Descriptor * +DLL_EXPORT const LADSPA_Descriptor * ladspa_descriptor(ulong index) { + if (!ready) _init(); + if (index != 0) return NULL; return &eqDescriptor; @@ -224,6 +229,8 @@ _init() { eqDescriptor.run = run_eq; eqDescriptor.run_adding = run_adding_eq; eqDescriptor.set_run_adding_gain = set_run_adding_gain; + + ready = 1; } void diff --git a/crap_util.h b/crap_util.h index 9996589..42617eb 100644 --- a/crap_util.h +++ b/crap_util.h @@ -1,3 +1,9 @@ +#ifdef WIN32 +#define DLL_EXPORT __declspec(dllexport) +#else +#define DLL_EXPORT +#endif + #ifndef M_PI #define M_PI 3.14159265358979323846264338327 #endif