[oolua] Re: Error when trying to Proxy a class

  • From: Mystic Sheik <mystic.sheik@xxxxxxxxx>
  • To: oolua@xxxxxxxxxxxxx
  • Date: Wed, 13 Jan 2016 17:15:09 +0100

Yeah, I corrected that typo. These are the files I'm trying to compile at
the moment, and I can't really find any mistakes in them according to the
documention.

2016-01-13 16:40 GMT+01:00 Liam Devine <liamdevine@xxxxxxxxx>:

You have not attached the latest files you are using, so I am unsure if
you also noticed the typo in the export macro. The class type is Derived
yet you have the following:
OOLUA_EXPORT_NO_FUNCTIONS(DerivedBase)

On 13/01/16 15:18, Mystic Sheik wrote:
Sorry, my bad. I moved the export macros from the header to the cpp
files, and left the proxy macros in the header files. I still get the
same error, telling me that "Proxy_class is not a template" though.

2016-01-13 15:15 GMT+01:00 Liam Devine <liamdevine@xxxxxxxxx
<mailto:liamdevine@xxxxxxxxx>>:

You still have the export macros in the header, as I have already
said
and as is state in the docs this will cause a compile error. They
need
to be in a source file.


On 13/01/16 13:23, Mystic Sheik wrote:
> These are the two files that won't compile. The library is linked
> properly, because everything else except the proxying works fine,
so I
> don't really know what the issue could be at this point. The
compiler
> gives me this error:
>
> "'OOLUA::Proxy_class' is not a specialization of a class template"
>
> 2016-01-13 13:01 GMT+01:00 Liam Devine <liamdevine@xxxxxxxxx
<mailto:liamdevine@xxxxxxxxx>
> <mailto:liamdevine@oolua. <mailto:liamdevine@oolua.>.org>>:
>
> Mystic,
>
> The library is tested against Visual Studio 2013 and does not
produce
> even a warning when using its compiler.
>
> I now notice that the code you posted has the
> OOLUA_EXPORT_FUNCTIONS/_CONST macros in the header and this
would be an
> error[1]. If after moving these to the cpp file, you still
encounter an
> error then please attach the files you are using to an email
in this
> thread..
>
>
> [1] https://oolua.org/docs/group___o_o_lua_exporting.html
>
> On 13/01/16 07:21, Mystic Sheik wrote:
> > I'm still getting an error from the compiler with the
> > OOLUA_PROXY(Derived, Base) and OOLUA_PROXY(Base) lines:
> >
> > error C2913: explicit specialization; 'OOLUA::Proxy_class'
is not a
> > specialization of a class
templatec:\users\user\documents\visual
> studio
> > 2013\projects\test\Derived.h
> >
> > Basically it seems to be an issue with template classes, but
I don't
> > really know how to fix it.
> >
> >
> > 2016-01-13 0:36 GMT+01:00 Liam Devine <liamdevine@xxxxxxxxx
<mailto:liamdevine@xxxxxxxxx>
<mailto:liamdevine@xxxxxxxxx <mailto:liamdevine@xxxxxxxxx>>
> > <mailto:liamdevine@xxxxxxxxx <mailto:liamdevine@xxxxxxxxx>
<mailto:liamdevine@xxxxxxxxx <mailto:liamdevine@xxxxxxxxx>>>>:
> >
> > Thank you for that Mystic. I can see that you have not
proxied
> the Base
> > class as I was guessing. The example in the
documentation[1],
> may be
> > should have a note applied to it. In the documentation
case,
> it is using
> > the class Abstract1 which has been proxied in the
previous
> example[2].
> > All examples for the docs are taken from straight from
the unit
> > tests[3], where you can hopefully see that both classes
are
> proxied.
> >
> > If we think about it, it does not make much sense to
tell the
> library
> > that there is a base class although not provide a proxy
so
> that it can
> > be used in Lua.
> >
> > [1]
https://oolua.org/docs/_o_o_lua_proxying.html#BaseClass
> > [2]
> https://oolua..org/docs/_o_o_lua_proxying.html#AbstractClass
> <https://oolua.org/docs/_o_o_lua_proxying.html#AbstractClass
<https://oolua..org/docs/_o_o_lua_proxying.html#AbstractClass>>
> > [3]
> >
>

https://bitbucket.org/liamdevine/oolua/src/37ebf2398265cff5d153cdac85f9d26e1f5bf2d7/unit_tests/bind_classes/expose_hierarchy.h?at=default
> >
> > On 12/01/16 21:09, Mystic Sheik wrote:
> > > Base.h:
> > > ============
> > >
> > > #pragma once
> > >
> > > class Base {
> > > public:
> > > Base();
> > > virtual Base();
> > > };
> > >
> > > Derived.h
> > > =============
> > >
> > > #pragma once
> > > #include "Base.h"
> > >
> > > class Derived : Base{
> > > public:
> > > Derived();
> > > };
> > >
> > > OOLUA_PROXY(Derived, Base)
> > > OOLUA_PROXY_END
> > >
> > > OOLUA_EXPORT_FUNCTIONS(DerivedBase)
> > > OOLUA_EXPORT_FUNCTIONS_CONST(DerivedBase)
> > >
> > > Test.cpp
> > > ==============
> > > void register() {
> > > vm = new OOLUA::Script
> > > <https://oolua.
.org/docs/class_o_o_l_u_a_1_1_script.html
> <https://oolua.org/docs/class_o_o_l_u_a_1_1_script.html>>;
> > > vm->register_class
> > >
> >
> <
https://oolua.org/docs/class_o_o_l_u_a_1_1_script.html#a870cd14a0757100bafcd5e4352894e83
<Derived>();
> > > }
> > >
> > >
> > >
> > > 2016-01-12 16:07 GMT+01:00 Liam Devine <
liamdevine@xxxxxxxxx <mailto:liamdevine@xxxxxxxxx>
> <mailto:liamdevine@xxxxxxxxx <mailto:liamdevine@xxxxxxxxx>>
<mailto:liamdevine@xxxxxxxxx <mailto:liamdevine@xxxxxxxxx>
> <mailto:liamdevine@xxxxxxxxx <mailto:liamdevine@xxxxxxxxx>>>
> > > <mailto:liamdevine@xxxxxxxxx <mailto:
liamdevine@xxxxxxxxx>
<mailto:liamdevine@xxxxxxxxx <mailto:liamdevine@xxxxxxxxx>>
> <mailto:liamdevine@xxxxxxxxx <mailto:liamdevine@xxxxxxxxx>
<mailto:liamdevine@xxxxxxxxx <mailto:liamdevine@xxxxxxxxx>>>>>:
> > >
> > > Hello Mystic,
> > >
> > > Could you please show a full yet minimal example
[1]? As an
> > example of
> > > why, I would have to guess if you have proxied
Base in
> your code.
> > >
> > >
> > > [1] http://oolua.org/contact.html#list
> <http://oolua..org/contact.html#list>
> > >
> > > On 12/01/16 11:11, Mystic Sheik wrote:
> > > > I'm trying to proxy a class:
> > > >
> > > > class Derived: public Base {};
> > > >
> > > > After what I've read in the documentation, it
should be as
> > simple
> > > as this:
> > > >
> > > > OOLUA_PROXY(Derived, Base)
> > > > OOLUA_PROXY_END
> > > >
> > > > However, I get an error saying that "Proxy_class
is not a
> > > template", and
> > >
> > > > the code won't compile and run. Is there
something I'm
> doing
> > wrong?
> > >
> > >
> > > --
> > > Liam
> > >
> > >
> > >
> > >
> > > --
> > >
> > > ~ MysticSheik
> > >
> >
> >
> > --
> > Liam
> >
> >
> >
> >
> > --
> >
> > ~ MysticSheik
> >
>
>
> --
> Liam
>
>
>
>
> --
>
> ~ MysticSheik
>


--
Liam




--

~ MysticSheik



--
Liam




--

~ MysticSheik
#include "Base.h"

OOLUA_EXPORT_NO_FUNCTIONS(Base)

Base::Base() {

}#pragma once

#include "Base.h"
#include <OOLua\oolua.h>

class Derived : Base {
public:
Derived();
};

OOLUA_PROXY(Derived, Base)
OOLUA_PROXY_END#include "Derived.h"

OOLUA_EXPORT_NO_FUNCTIONS(Derived

Derived::Derived() {

}
#pragma once

#include <OOLua\oolua.h>

class Base {
public:
Base();
virtual ~Base();
};

OOLUA_PROXY(Base)
OOLUA_PROXY_END


Other related posts: