lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi,

I am testing out Lua 5.1(work 4) against a patched 5.0.2 version (using an OSX loadlib patch from http://archive.neotonic.com/archive/lua-l/messages/16245?mode=author&noheader=1

My patched version seems to loadlib fine, but the 5.1(4) version seems not to. I have commented out MYLDFLAGS and MYLIBS in src/Makefile, as recommended elsewhere on the web (as I understand these are Linux-directed and avoids the "undefined -E" problem).

terminal session below. lua is the 5.0.2 version (libs and app), ./lua is the 5.1(4) version, and ./swapLua is a shell script rotating the lualibs in /usr/local: ---------------------------------- bash-2.05a$ lua test.lua Component1 foo! Component1 bar! bash-2.05a$ ./swapLua bash-2.05a$ ./lua test.lua symbol `create' not found init bash-2.05a$ ---------------------------------- test lua below: ---------------------------------- create,err1,err2 = loadlib("./comp1.cpp.comp","create");

if (create) then comp1 = create() else print(err1)
   print(err2)
end

if (comp1) then
   comp1["foo"]()
   comp1["bar"]()
end
-----------------------------------
comp1.cpp's create follows:
-----------------------------------
extern "C"
int create (LuaState l) {
   Component::create_(l);
return 1; } ----------------------------------- create is a static template class function, which instantiates the component1 object, creates a lua table, populates it with extern "C" functions and returns it.

Is this from a different approach to the patch I have been using, as I would prefer to use the "authorised" version of loadlib if possible? I am fully prepared that my coding approach is flawed :)

Thanks,
James

This message has been checked for viruses but the contents of an attachment
may still contain software viruses, which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.