Hi Atom,
Is there any way to add a new C++ class to Ctrlr and make it accessible from Lua ?
I have tried adding a new class in \Source\Lua\JuceClasses called LTest which is similar to LColour .
Here is Source\Lua\JuceClasses\LTest.h :
#ifndef __L_TEST__
#define __L_TEST__
#include “CtrlrLuaManager.h”
class LTest
{
public:
LTest(int i) {}
int getValue() const { return 5; }
static void wrapForLua (lua_State *L);
};
#endif
————————-
Here is Source\Lua\JuceClasses\LTest.cpp,
#include “stdafx.h”
#include “LTest.h”
void LTest::wrapForLua (lua_State *L)
{
using namespace luabind;
module(L)
[
class_(“Test”)
.def(constructor())
.def(“getValue”, <est::getValue)
];
}
I am not trying to wrap a JUCE class, I am simply exposing a simple function from LTest itself.
But I get a linker error:
error LNK2019: unresolved external symbol “public: static void __cdecl LTest::wrapForLua(struct lua_State *)” (?wrapForLua@LTest@@SAXPAUlua_State@@@Z) referenced in function “public: void __thiscall CtrlrLuaManager::wrapJuceClasses(struct lua_State *)” (?wrapJuceClasses@CtrlrLuaManager@@QAEXPAUlua_State@@@Z) P:\p4\anandy_anandy-lt_1775\Import\VSS\AudioTools\Src\Prototypes\AuVidPanels\Builds\Generated\Windows\VST\CtrlrWrap.obj
Using Visual Studio 2010.