summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2019-12-03 17:55:37 +0100
committerRobin Gareus <robin@gareus.org>2019-12-03 17:55:37 +0100
commit1f7366875618978aa9deb0e9a43f9532c6688e9a (patch)
treeb6b6c80c5ce81f7d1beef095cca03a07a7ff1f3e
parentbfcadff73cae12fc74569f1684f6e177b5d0c982 (diff)
New approach for Lua bindings to avoid LuaBridge_API in GUI code
Declare DoubleArray in GUI context so that runtime uses the symbol from the .exe (not the .dll). This is mainly for the benefit of MSVC, that does not allow to use LuaBridge_API in .exe
-rw-r--r--gtk2_ardour/luainstance.cc36
-rw-r--r--libs/ardour/luabindings.cc1
2 files changed, 2 insertions, 35 deletions
diff --git a/gtk2_ardour/luainstance.cc b/gtk2_ardour/luainstance.cc
index d0529017ae..f1da28c826 100644
--- a/gtk2_ardour/luainstance.cc
+++ b/gtk2_ardour/luainstance.cc
@@ -62,41 +62,6 @@
static const char* ui_scripts_file_name = "ui_scripts";
-#ifdef PLATFORM_WINDOWS
-/* see libs/ardour/luabindings.cc for details */
-
-template <class T>
-void const*
-luabridge::ClassInfo<T>::getStaticKey ()
-{
- static char value;
- return &value;
-}
-
-template <class T>
-void const*
-luabridge::ClassInfo<T>::getClassKey ()
-{
- static char value;
- return &value;
-}
-
-template <class T>
-void const*
-luabridge::ClassInfo<T>::getConstKey ()
-{
- static char value;
- return &value;
-}
-
-#define CLASSKEYS(CLS) \
- template void const* luabridge::ClassInfo< CLS >::getStaticKey(); \
- template void const* luabridge::ClassInfo< CLS >::getClassKey(); \
- template void const* luabridge::ClassInfo< CLS >::getConstKey();
-
-CLASSKEYS(std::vector<double>);
-#endif
-
namespace LuaCairo {
/** wrap RefPtr< Cairo::ImageSurface >
*
@@ -607,6 +572,7 @@ LuaInstance::bind_cairo (lua_State* L)
*/
luabridge::getGlobalNamespace (L)
.beginNamespace ("C")
+ .registerArray <double> ("DoubleArray")
.beginStdVector <double> ("DoubleVector")
.endClass ()
.endNamespace ();
diff --git a/libs/ardour/luabindings.cc b/libs/ardour/luabindings.cc
index 88bca48243..e29c31285f 100644
--- a/libs/ardour/luabindings.cc
+++ b/libs/ardour/luabindings.cc
@@ -184,6 +184,7 @@ CLASSKEYS(std::bitset<49ul>); // LuaSignal::LAST_SIGNAL
CLASSKEYS(void);
CLASSKEYS(float);
+CLASSKEYS(double);
CLASSKEYS(unsigned char);
CLASSKEYS(ArdourMarker*);