2 Commits

Author SHA1 Message Date
39540e9c3e add pragma macros,
silences -Wcast-function-type
2024-07-09 15:57:38 +01:00
af98dead75 swap blocks. 2024-07-09 15:11:48 +01:00
4 changed files with 20 additions and 9 deletions

View File

@@ -33,6 +33,6 @@ $(BIN_DIR) $(OBJ_DIR):
pwsh -Command New-Item -Path $@ -ItemType Directory
clean:
pwsh -Command Remove-Item -Recurse $(EXE), $(OBJ_DIR)
pwsh -Command Remove-Item -Recurse $(EXE), $(OBJ_DIR) -force
-include $(OBJ:.o=.d)

View File

@@ -20,6 +20,13 @@
#include "util.h"
#include "log.h"
#define PRAGMA_IgnoreWCastIncompatibleFuncTypes \
_Pragma("GCC diagnostic push") \
_Pragma("GCC diagnostic ignored \"-Wcast-function-type\"")
#define PRAGMA_Pop \
_Pragma("GCC diagnostic pop")
static T_VBVMR_INTERFACE iVMR;
static long initialize_dll_interfaces(PT_VMR vmr);
@@ -79,6 +86,8 @@ static long initialize_dll_interfaces(PT_VMR vmr)
if (G_H_Module == NULL)
return -101;
PRAGMA_IgnoreWCastIncompatibleFuncTypes;
// Get function pointers
vmr->VBVMR_Login = (T_VBVMR_Login)GetProcAddress(G_H_Module, "VBVMR_Login");
vmr->VBVMR_Logout = (T_VBVMR_Logout)GetProcAddress(G_H_Module, "VBVMR_Logout");
@@ -110,6 +119,8 @@ static long initialize_dll_interfaces(PT_VMR vmr)
vmr->VBVMR_MacroButton_GetStatus = (T_VBVMR_MacroButton_GetStatus)GetProcAddress(G_H_Module, "VBVMR_MacroButton_GetStatus");
vmr->VBVMR_MacroButton_SetStatus = (T_VBVMR_MacroButton_SetStatus)GetProcAddress(G_H_Module, "VBVMR_MacroButton_SetStatus");
PRAGMA_Pop;
// check pointers are valid
if (vmr->VBVMR_Login == NULL)
return -1;

View File

@@ -144,7 +144,7 @@ int main(int argc, char *argv[])
PT_VMR vmr = create_interface();
int rep = login(vmr, kind);
long rep = login(vmr, kind);
if (rep != 0)
{
log_fatal("Error logging into the Voicemeeter API");
@@ -185,15 +185,15 @@ int main(int argc, char *argv[])
}
rep = logout(vmr);
if (rep == 0)
{
return EXIT_SUCCESS;
}
else
if (rep != 0)
{
log_fatal("Error logging out of the Voicemeeter API");
return EXIT_FAILURE;
}
else
{
return EXIT_SUCCESS;
}
}
/**

View File

@@ -30,7 +30,7 @@
*/
long login(PT_VMR vmr, int kind)
{
int rep;
long rep;
long v;
log_trace("VBVMR_Login()");
@@ -75,7 +75,7 @@ long login(PT_VMR vmr, int kind)
*/
long logout(PT_VMR vmr)
{
int rep;
long rep;
Sleep(20); /* give time for last command */
log_trace("VBVMR_Logout()");