From bc275e10defe27e6d288ccf9125fe9b915168240 Mon Sep 17 00:00:00 2001 From: cbdev Date: Tue, 21 Apr 2020 00:20:23 +0200 Subject: Do not load lua backend automatically on Windows --- backends/Makefile | 2 +- backends/libmmbackend.c | 7 +++++++ backends/lua.md | 5 ++--- backends/rtpmidi.c | 2 +- 4 files changed, 11 insertions(+), 5 deletions(-) (limited to 'backends') diff --git a/backends/Makefile b/backends/Makefile index 1e66995..700c9b3 100644 --- a/backends/Makefile +++ b/backends/Makefile @@ -65,7 +65,7 @@ ola.so: CPPFLAGS += -Wno-write-strings lua.so: CFLAGS += $(shell pkg-config --cflags lua53 || pkg-config --cflags lua5.3 || echo "-DBUILD_ERROR=\"Missing pkg-config data for lua53\"") lua.so: LDLIBS += $(shell pkg-config --libs lua53 || pkg-config --libs lua5.3 || echo "-DBUILD_ERROR=\"Missing pkg-config data for lua53\"") lua.dll: CFLAGS += $(shell pkg-config --cflags lua53 || pkg-config --cflags lua5.3 || echo "-DBUILD_ERROR=\"Missing pkg-config data for lua53\"") -lua.dll: LDLIBS += -L../libs -llua53 +lua.dll: LDLIBS += -L../ -llua53 python.so: CFLAGS += $(shell pkg-config --cflags python3 || pkg-config --cflags python || echo "-DBUILD_ERROR=\"Missing pkg-config data for python3\"") python.so: CFLAGS += $(shell pkg-config --libs python3 || pkg-config --libs python || echo "-DBUILD_ERROR=\"Missing pkg-config data for python3\"") diff --git a/backends/libmmbackend.c b/backends/libmmbackend.c index 2bbc226..92adc3c 100644 --- a/backends/libmmbackend.c +++ b/backends/libmmbackend.c @@ -20,8 +20,15 @@ int mmbackend_strdup(char** dest, char* src){ char* mmbackend_socket_strerror(int err_no){ #ifdef _WIN32 static char error[2048] = ""; + ssize_t u; FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, WSAGetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), error, sizeof(error), NULL); + //remove trailing newline that for some reason is included in most of these... + for(u = strlen(error) - 1; u > 0; u--){ + if(!isprint(error[u])){ + error[u] = 0; + } + } return error; #else return strerror(err_no); diff --git a/backends/lua.md b/backends/lua.md index e59e513..0a31dce 100644 --- a/backends/lua.md +++ b/backends/lua.md @@ -101,7 +101,6 @@ the MIDIMonster project can not provide this file within this repository. You will need to acquire a copy of `lua53.dll`, for example by downloading it from the [luabinaries project](http://luabinaries.sourceforge.net/download.html). -To build the `lua` backend for Windows, place `lua53.dll` in a subdirectory `libs/` in the project root -and run `make lua.dll` inside the `backends/` directory. - +Place this file in the project root directory and run `make lua.dll` inside the `backends/` directory +to build the backend. At runtime, Windows searches for the file in the same directory as `midimonster.exe`. diff --git a/backends/rtpmidi.c b/backends/rtpmidi.c index 52cb0c5..7df8563 100644 --- a/backends/rtpmidi.c +++ b/backends/rtpmidi.c @@ -525,7 +525,7 @@ static int rtpmidi_applecommand(instance* inst, struct sockaddr* dest, socklen_t //FIXME should we match sending/receiving ports? if the reference does this, it should be documented bytes = sendto(control ? data->control_fd : data->fd, frame, sizeof(apple_command) + strlen(inst->name) + 1, 0, dest, dest_len); if(bytes != sizeof(apple_command) + strlen(inst->name) + 1){ - LOGPF("Failed to transmit session command on %s", inst->name); + LOGPF("Failed to transmit session command on %s: %s", inst->name, mmbackend_socket_strerror(errno)); return 1; } return 0; -- cgit v1.2.3