Skip to content

Commit

Permalink
fix multichannel check for _WIN32?
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-wes committed May 24, 2024
1 parent 73596f2 commit 52ab99e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion simplex~.c
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,15 @@ static void *simplex_tilde_new(t_symbol *s, int ac, t_atom *av) {

void simplex_tilde_setup(void) {
#ifdef _WIN32
g_signal_setmultiout = (t_signal_setmultiout)GetProcAddress(GetModuleHandle(NULL), "signal_setmultiout");
// get a handle to the module containing the Pd API functions.
// NB: GetModuleHandle("pd.dll") does not cover all cases.
HMODULE module;
if (GetModuleHandleEx(
GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
(LPCSTR)&pd_typedmess, &module)) {
g_signal_setmultiout = (t_signal_setmultiout)(void *)GetProcAddress(
module, "signal_setmultiout");
}
#else
g_signal_setmultiout = (t_signal_setmultiout)dlsym(dlopen(NULL, RTLD_NOW), "signal_setmultiout");
#endif
Expand Down

0 comments on commit 52ab99e

Please sign in to comment.