This fixes an issue with recent MSVC causing a compile-error
due to __attribute__((constructor))
This commit is contained in:
Robin Gareus 2021-02-28 16:27:22 +01:00
parent b553b67407
commit 7195ca20e0
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
3 changed files with 15 additions and 4 deletions

View File

@ -53,7 +53,7 @@ static void* lib_symbol(void* const lib, const char* const sym) {
#endif
}
#ifdef COMPILER_MSVC
#if defined _MSC_VER && ! defined __INTEL_COMPILER
typedef void * pvoid_t;
#define MAPSYM(SYM, FAIL) _j._ ## SYM = (func_t)lib_symbol(lib, "jack_" # SYM); \
if (!_j._ ## SYM) err |= FAIL;
@ -92,8 +92,9 @@ static struct WeakJack {
} _j;
static int _status = -1;
#if !defined _MSC_VER || defined __INTEL_COMPILER
__attribute__((constructor))
#endif
static void init_weak_jack(void)
{
void* lib;
@ -110,7 +111,7 @@ static void init_weak_jack(void)
lib = lib_open("/usr/local/lib/libjack.dylib");
}
#elif (defined PLATFORM_WINDOWS)
# if ( defined(__x86_64__) || defined(_M_X64) )
# if defined(__x86_64__) || defined(_M_X64) || defined(__amd64__)
lib = lib_open("libjack64.dll");
# else
lib = lib_open("libjack.dll");

View File

@ -32,6 +32,8 @@ JVFUN(1, set_info_function, (void (*f)(const char *)), (f),)
JCFUN(1, int, activate, -1)
JCFUN(1, int, deactivate, -1)
JPFUN(1, int, client_name_size, (), (), 32)
JCFUN(1, jack_nframes_t, get_sample_rate, 0)
JCFUN(1, jack_nframes_t, get_buffer_size, 0)
JPFUN(1, jack_nframes_t, frames_since_cycle_start, (const jack_client_t *c), (c), 0)
@ -58,6 +60,7 @@ JPFUN(1, const char*, port_name, (const jack_port_t *p), (p), NULL)
JPFUN(1, const char*, port_short_name, (const jack_port_t *p), (p), NULL)
JPFUN(1, int, port_flags, (const jack_port_t *p), (p), 0)
JPFUN(1, int, port_is_mine, (const jack_client_t *c, const jack_port_t *p), (c,p), 0)
JPFUN(1, int, port_connected, (const jack_port_t *p), (p), 0)
JPFUN(1, const char**, get_ports,(jack_client_t *c, const char *p, const char *t, unsigned long f), (c,p,t,f), NULL)
JPFUN(1, int, port_name_size, (void), (), 0)
JPFUN(1, int, port_type_size, (void), (), 0)
@ -70,7 +73,10 @@ JPFUN(1, const char *, port_type, (const jack_port_t *p), (p), 0)
JPFUN(1, const char **, port_get_connections, (const jack_port_t *p), (p), 0)
JPFUN(1, const char **, port_get_all_connections, (const jack_client_t *c, const jack_port_t *p), (c,p), 0)
JPFUN(1, int, port_set_name, (jack_port_t *p, const char *n), (p,n), -1)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
JXFUN(0, int, port_rename, (jack_client_t *c, jack_port_t *p, const char *n), (c,p,n), return jack_port_set_name (p,n);)
#pragma GCC diagnostic pop
JPFUN(1, int, port_get_aliases, (const jack_port_t *port, char* const aliases[2]), (port,aliases), 0)
JPFUN(1, int, port_disconnect, (jack_client_t *c, jack_port_t *p), (c,p), 0)
JPFUN(1, int, connect, (jack_client_t *c, const char *s, const char *d), (c,s,d), -1)
@ -89,6 +95,7 @@ JPFUN(1, jack_nframes_t, get_current_transport_frame, (const jack_client_t *c),
JXFUN(1, jack_transport_state_t, transport_query, (const jack_client_t *c, jack_position_t *p), (c,p), memset(p, 0, sizeof(jack_position_t)); return JackTransportStopped;)
JPFUN(1, int, set_sync_callback, (jack_client_t *c, JackSyncCallback p, void *a), (c,p,a), -1)
JPFUN(1, int, set_timebase_callback, (jack_client_t *c, int l, JackTimebaseCallback p, void *a), (c,l,p,a), -1)
JPFUN(1, int, set_sync_timeout, (jack_client_t *c, jack_time_t t), (c,t), -1)
JCFUN(1, int, release_timebase, 0)
/* <jack/midiport.h> */
@ -124,7 +131,7 @@ JPFUN(0, int, acquire_real_time_scheduling, (jack_native_thread_t t,
JPFUN(0, int, drop_real_time_scheduling, (jack_native_thread_t t), (t), 0)
JPFUN(0, int, client_stop_thread, (jack_client_t* c, jack_native_thread_t t), (c,t), 0)
JPFUN(0, int, client_kill_thread, (jack_client_t* c, jack_native_thread_t t), (c,t), 0)
#ifndef WIN32
#ifndef _WIN32
JVFUN(0, set_thread_creator, (jack_thread_creator_t c), (c),)
#endif
JPFUN(1, int, client_create_thread, \

View File

@ -59,6 +59,8 @@ int have_libjack(void);
#define jack_cpu_load WJACK_cpu_load
#define jack_is_realtime WJACK_is_realtime
#define jack_client_name_size WJACK_client_name_size
#define jack_set_freewheel WJACK_set_freewheel
#define jack_set_buffer_size WJACK_set_buffer_size
@ -92,6 +94,7 @@ int have_libjack(void);
#define jack_port_short_name WJACK_port_short_name
#define jack_port_flags WJACK_port_flags
#define jack_port_is_mine WJACK_port_is_mine
#define jack_port_connected WJACK_port_connected
#define jack_get_ports WJACK_get_ports
#define jack_port_name_size WJACK_port_name_size
#define jack_port_type_size WJACK_port_type_size