Re: Unknown reference when trying to access the wrapper DLL
Schala Zeal <[email protected]>
| Newsgroups | gmane.comp.lang.lua.bind.user |
|---|---|
| Message-ID | <[email protected]> |
Sorry for the late reply. I'm getting an error now with VC 2008 of type
C2440 when I declare a constructor. The code I'm assuming is causing the
problem is:
<pre>
class ScriptTest
{
private:
char *text;
public:
ScriptTest(char *txt): text(txt) {};
~ScriptTest();
char* GetText() const {return text;};
};
</pre>
and the LuaBind work is this:
<pre>
module(l) [
class_<ScriptTest>("ScriptTest")
.def(constructor<char*>())
.def("GetText", &ScriptTest::GetText)
];
</pre>
I'm getting a huge error from call.hpp about that:
Error 1 error C2664: 'void
luabind::detail::construct_aux<Arity,T,Pointer,Signature>::operator ()(const
luabind::adl::argument &,char *) const' : cannot convert parameter 2 from
'const char *' to 'char *' C:\Program Files\Microsoft Visual Studio
9.0\VC\include\luabind\detail\call.hpp 294
On Tue, Jan 5, 2010 at 4:32 AM, Tristan-37 <[email protected]> wrote:
>
> Hi,
>
> when you issue 'bjam' in the examples/hello_word directory it will create a
> hello_worldd.dll (notice the second d at the end, it stands for 'debug').
> You
> can use 'bjam variant=release' to get the non-debug version of the dll,
> this
> file is then called 'hello_world.dll' (now without an additional d).
>
> Make sure to append the 'd' when using the debug build of your dll!
>
> To load your dll you have to use then
> > f,e1,e2 = package.loadlib("hello_worldd.dll", "init") -- notice the
> > additional 'd'
> This function returns 3 values:
> f is a function pointer to the init function or nil on failure. e1 and e2
> are
> strings with an error message.
> > print(f,e1, e2) -- show what happened
> When everything worked f is a function and e1 and e2 are nil. Now you can
> call
> the init function by issuing:
> > f() -- this will register the greet method using Luabind.
>
> Note, that 'f,e1,e2 = package.loadlib("hello_worldd.dll", "init")()' is
> just
> the short form of the above steps.
>
> Hint: When you name your init function 'int luaopen_DLLNAME(lua_State* L)'
> (replace DLLNAME with the name of your dll) you can use 'require "DLLNAME"'
> in
> Lua and your init function is automatically executed.
>
>
>
> Schala Zeal wrote:
> >
> > Well, I compiled a working Lua 5.1.4 -- stripped though, "strip -g
> > --strip-unneeded" for the DLL. I have Boost 1.41 headers in the standard
> > include directory under the subdirectory 'include/boost', Boost-Build V2
> > M12
> > present and the BOOST_ROOT set along with LUA_ROOT. BJam compiled it
> > successfully with "bjam --toolset=gcc test" and I moved the headers to
> > "include/luabind" and the static library (liblua.lib I believe) to my
> > MinGW
> > lib directory. Though, I had to rename liblua.a (the name the Lua library
> > compiled to) to liblua5.1.a because I got errors before then about
> > "-llua5.1"
> >
> > The examples I simply did "bjam --toolset=gcc" on, but those don't work.
> > My
> > own projects use "g++ -shared somesourcefile.o -o somelibrary.dll
> > -lluabind
> > -llua5.1" and deliver the same result.
> >
> > On Sat, Jan 2, 2010 at 5:51 AM, Kristoffer Danielsson <
> > [email protected]> wrote:
> >
> >> Perhaps hello_world.dll is not present or maybe corrupt?
> >>
> >> ------------------------------
> >> Date: Fri, 1 Jan 2010 21:03:33 -0800
> >> From: [email protected]
> >> To: [email protected]
> >> Subject: [luabind] Unknown reference when trying to access the wrapper
> >> DLL
> >>
> >>
> >> Hello, I've been having some troubles with Luabind on MinGW, trying to
> >> make
> >> a test to see if it would work or not. Everything compiles okay... Well,
> >> that is... it compiles, at least. Though when I try to use it in Lua
> 5.1,
> >> the following occurs (this happens with provided examples as well)
> >>
> >> > package.loadlib("hello_world.dll", "init") -- for the record,
> "init")()
> >> results in a "nil value" error
> >> > greet()
> >> stdin: attempt to call global 'greet' (a nil value)
> >> ... etc
> >>
> >> This is the hello world example provided with Luabind 0.9 RC1. greet()
> is
> >> defined to be in Lua's global namespace, so, I don't know what the heck
> >> Lua's interpreter wants. An inputted script produces the same result.
> >> Please
> >> help. Thank you.
> >
>
> --
> View this message in context:
> http://old.nabble.com/Unknown-reference-when-trying-to-access-the-wrapper-DLL-tp26990717p27026594.html
> Sent from the Lua C++ Bind mailing list archive at Nabble.com.
>
>
>
> ------------------------------------------------------------------------------
> This SF.Net email is sponsored by the Verizon Developer Community
> Take advantage of Verizon's best-in-class app development support
> A streamlined, 14 day to market process makes app distribution fast and
> easy
> Join now and get one step closer to millions of Verizon customers
> http://p.sf.net/sfu/verizon-dev2dev
> _______________________________________________
> luabind-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/luabind-user
>
------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
luabind-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/luabind-user