From 0d612325e6f2aa1a8d2a446970fc4c92657ea39f Mon Sep 17 00:00:00 2001 From: Albert Graef <aggraef@gmail.com> Date: Sat, 17 Feb 2018 06:12:30 +0100 Subject: [PATCH] nw.js (Pd-l2ork 2.x) support: opening the Lua script file in Purr Data now does the right thing on Windows, too --- pdlua.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/pdlua.c b/pdlua.c index d1edeb9..9e17182 100644 --- a/pdlua.c +++ b/pdlua.c @@ -1626,7 +1626,9 @@ static int pdlua_loader_pathwise } -#ifndef WIN32 +#ifdef WIN32 +#include <windows.h> +#else #define __USE_GNU // to get RTLD_DEFAULT #include <dlfcn.h> // for dlsym #ifndef RTLD_DEFAULT @@ -1743,13 +1745,14 @@ void pdlua_setup(void) error("lua: loader will not be registered!"); } PDLUA_DEBUG("pdlua_setup: end. stack top %d", lua_gettop(L)); -#ifndef WIN32 - /* nw.js support (currently only supported on Linux and Mac). XXXTODO: - Make this work on Windows as well. */ + /* nw.js support. */ +#ifdef WIN32 + nw_gui_vmess = (void*)GetProcAddress(GetModuleHandle("pd.dll"), "gui_vmess"); +#else nw_gui_vmess = dlsym(RTLD_DEFAULT, "gui_vmess"); +#endif if (nw_gui_vmess) post("pdlua: using JavaScript interface (Pd-l2ork nw.js version)"); -#endif } -- GitLab