summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2014-10-05 21:15:07 +0200
committerAndreas Baumann <mail@andreasbaumann.cc>2014-10-05 21:15:07 +0200
commitb577b7119aa1f57c4db7fd254c2b5b197e7451d2 (patch)
tree35a414060da573f1d761dad2bb03f00e93b8bbef
parentb0e4bb27b2f5cb2b54cb615a3100ef8aa4474600 (diff)
downloadcrawler-b577b7119aa1f57c4db7fd254c2b5b197e7451d2.tar.gz
crawler-b577b7119aa1f57c4db7fd254c2b5b197e7451d2.tar.bz2
must load all symbols of a C++/Lua module, otherwise the lua_open function
can't be called from the Lua VM during module initialization
-rwxr-xr-xinclude/module/ModuleLoader.hpp2
-rwxr-xr-xtests/tolua/libtest1/TestMod.cpp2
-rwxr-xr-xtests/tolua/test1.cpp2
-rw-r--r--tests/tolua/test1.lua1
4 files changed, 2 insertions, 5 deletions
diff --git a/include/module/ModuleLoader.hpp b/include/module/ModuleLoader.hpp
index 6eb9079..21905ec 100755
--- a/include/module/ModuleLoader.hpp
+++ b/include/module/ModuleLoader.hpp
@@ -50,7 +50,7 @@ class BaseModuleLoader {
for( std::vector<std::string>::const_iterator it = files.begin( ); it != files.end( ); it++ ) {
#ifndef _WIN32
- m.handle = dlopen( it->c_str( ), RTLD_NOW | RTLD_LOCAL );
+ m.handle = dlopen( it->c_str( ), RTLD_NOW | RTLD_GLOBAL );
#else
m.handle = LoadLibrary( it->c_str( ) );
#endif
diff --git a/tests/tolua/libtest1/TestMod.cpp b/tests/tolua/libtest1/TestMod.cpp
index afef87a..912d652 100755
--- a/tests/tolua/libtest1/TestMod.cpp
+++ b/tests/tolua/libtest1/TestMod.cpp
@@ -16,8 +16,6 @@ static void initModule( void *user_data )
{
LuaVM *luaVm = (LuaVM *)user_data;
- cout << luaVm->handle( ) << endl;
-
tolua_TestMod_open( luaVm->handle( ) );
}
diff --git a/tests/tolua/test1.cpp b/tests/tolua/test1.cpp
index a2bff4d..902b278 100755
--- a/tests/tolua/test1.cpp
+++ b/tests/tolua/test1.cpp
@@ -16,8 +16,6 @@ int main( int /* argc */, char *argv[] )
LuaVM luaVm;
- cout << luaVm.handle( ) << endl;
-
vector<string> modules;
modules.push_back( "./libtest1/mod_test.so" );
ModuleLoader<Base> loader( modules, (void *)&luaVm );
diff --git a/tests/tolua/test1.lua b/tests/tolua/test1.lua
index 20d97cf..74b3852 100644
--- a/tests/tolua/test1.lua
+++ b/tests/tolua/test1.lua
@@ -1 +1,2 @@
local b = Derived:new( )
+b:hello( )