Re: Trouble running the hello world application

Robert Vasek <[email protected]> Fri, 14 Sep 2012 15:37:26 +0200
Newsgroups gmane.comp.lang.lua.bind.user
Message-ID <alpine.DEB.2.02.1209141424110.13516@tznaf-zntvpobk>
On Thu, 13 Sep 2012, Tom McCubbin wrote:

> In linux it uses the normal lua search path.  if the library loaded has
> dependencies it will use the path in $LD_LIBRARY_PATH to search for them,
> or the rpath embedded in the library loaded.
> 
> On Thu, Sep 13, 2012 at 9:03 AM, Willi Schinmeyer <[email protected]>wrote:
> 
> > > Can I use require to load dynamic libraries?
> > Works on windows anyway. Not sure which directories are searched on
> > Linux, but it should work somehow.
> >
> >
> > ------------------------------------------------------------------------------
> > Live Security Virtual Conference
> > Exclusive live event will cover all the ways today's security and
> > threat landscape has changed and how IT managers can respond. Discussions
> > will include endpoint security, mobile security and the latest in malware
> > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> > _______________________________________________
> > luabind-user mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/luabind-user
> >
> 

Yeah when I type:
require("libhellobind.so")

apparently it can find the lib (which is located in the same dir as the 
.lua file), however it gives me this error with an undefined symbol:
$ lua test.lua 
lua: error loading module 'libhellobind.so' from file 
'./libhellobind.so':
	./libhellobind.so: undefined symbol: 
_ZTIN7luabind6detail12registrationE
stack traceback:
	[C]: ?
	[C]: in function 'require'
	test.lua:6: in main chunk
	[C]: ?

So I may be creating the shared library somehow wrong.
$ g++ hellobind.cpp -I/usr/include/lua5.1/ -c -fPIC
$ g++ -shared -Wl,-soname,libhellobind.so.0 -o \
libhellobind.so.0.0 hellobind.o

test.lua:
    1 require("libhellobind.so")

And after running the lua file, the mentioned error occurs.

I've also found this: 
http://www.gamedev.net/topic/624251-luabind-inside-a-shared-library/
"// int luaopen_[libname] is the entry point"
no luck with that either, still the same error.

Thanks for all the respones so far.

------------------------------------------------------------------------------
Got visibility?
Most devs has no idea what their production app looks like.
Find out how fast your code is with AppDynamics Lite.
http://ad.doubleclick.net/clk;262219671;13503038;y?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html