Re: Problem with derived classes and overloaded member functions

Daniel Wallin <[email protected]>
Newsgroups gmane.comp.lang.lua.bind.user
Message-ID <[email protected]>
On 3/24/10 5:02 AM, Saner Daniel wrote:
> Thank you for the quick response.
> (I hope I didn't mess up the 'reply-to')
> Unfortunately this was not the problem, I am always calling the
> function with the double dot. In fact, the error message is exactly the
> same though as if I was writing it with the dot and no 'self' argument.
> 
> I'm afraid to say that only now I noticed that the problem does in
> fact not relate to the functions being overloaded. I failed to notice
> that by chance, *all* functions of the class in questions were
> overloaded. I added a non-overloaded dummy function to the class and it
> gives the same error:

>> obj:doNothing()
> No matching overload found, candidates:
> void doNothing(PluginCLGeneric&)
> 
> I was thinking that maybe this is a problem related to how I
> register
> the object itself with Lua. The object is not created directly by
> calling the constructor from Lua, but a factory function which takes the
> name to give the object as a string argument. Calling this factory from
> Lua creates the object and then registers it as a global:
> 
> luabind::globals(L)[objectName] = createdInstance;
> 
> where 'createdInstance' is a pointer to the created object. Also,
> the
> class of the object and its functions have been registered with Luabind
> beforehand. This multi-step process was necessary due to the plugin
> architecture I am using it for. The process cannot be a complete failure
> though, as the object is accessible from Lua under 'objectName', and
> also the functions of the class have been registered. If any of these
> are not given, the error message does not reference the possible
> overload candidates anymore.
> As the exact same procedure for an object of a non-derived class
> that
> is created at startup works flawlessly, I am lead to believe that it is
> indeed a problem of inheritance, but I was still not able to find the
> culprit. Maybe Lua is confused about the class of the created object?


It shouldn't be. Everything in your post looks reasonable, so I guess
this could be a bug. Could you possibly reduce this to a failing test
that I can run?

-- 
Daniel Wallin
BoostPro Computing
http://www.boostpro.com

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.