Re: weak_ref issue patch

Glen Fraser <[email protected]> Tue, 23 Jul 2013 10:11:13 +0200
Newsgroups gmane.comp.lang.lua.bind.user
Message-ID <[email protected]>
--===============5411429912069254457==
Content-Type: multipart/alternative;
	boundary="Apple-Mail=_B5BAC788-ED0F-4D61-BB1F-D209F2BC40EE"


--Apple-Mail=_B5BAC788-ED0F-4D61-BB1F-D209F2BC40EE
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=windows-1252

How embarrassing, sorry for the noise, I was barking up the wrong tree.  =
This turned out to be (of course) a stupid change where I was including =
adopt_policy.hpp before luabind.hpp -- doh!

Sorry.

Now, when I try to use the adopt policy, I get errors like Sympaval had =
(in this thread: =
http://lua.2524044.n2.nabble.com/Remove-an-object-from-the-lua-state-tp758=
3423p7583425.html).  He didn't manage to get adopt working when binding, =
but rather chose to instead use it with using call_function.

Same as him -- I get errors like this, when trying to use adopt(_2) in a =
def():

.../boost/include/boost/preprocessor/iteration/detail/local.hpp:37:9: No =
member named 'consumed_args' in 'luabind::detail::adopt_policy<2, =
void>::only_accepts_nonconst_pointers'
.../boost/include/boost/preprocessor/iteration/detail/local.hpp:37:9: No =
member named 'converter_postcall' in 'luabind::detail::adopt_policy<2, =
void>::only_accepts_nonconst_pointers'
.../addons/ofxLua/src/luabind/luabind/detail/call.hpp:295:48: No member =
named 'apply' in 'luabind::detail::adopt_policy<2, =
void>::only_accepts_nonconst_pointers'

And when I try to use it with call_function:

.../addons/ofxLua/src/luabind/luabind/detail/call_function.hpp:200:20: =
No member named 'match' in 'luabind::detail::adopt_policy<0, =
void>::only_accepts_nonconst_pointers'

Is this because the latest luabind requires C++0x/C++11 compilation and =
standard libs?  Currently, I can't do that because I'm using it inside =
OpenFrameworks v0074, which still uses std::tr1 things -- but I guess I =
can try to change that locally (if that's the solution).  Or should I go =
back to an older version of luabind?

Thanks again (though I feel like I'm talking to myself ;-),
Glen.

On Jul 22, 2013, at 4:49 PM, Glen Fraser <[email protected]> wrote:

> It turns out that the patch does not fix my problem.  After more =
web-searching, I see I should be using the adopt policy =
(http://www.rasterbar.com/products/luabind/docs.html#adopt), to pass Lua =
object ownership to C++.  However, whenever I try to include =
luabind/adopt_policy.hpp, I get tons of errors (on Xcode 4.6.3 with =
clang or gcc).
>=20
> With Clang LLVM:
> .../addons/ofxLua/src/luabind/luabind/handle.hpp:136:5: Expected =
member name or ';' after declaration specifiers
> .../addons/ofxLua/src/luabind/luabind/detail/has_get_pointer.hpp:82:3: =
Declaration does not declare anything
> =85

> With LLVM GCC:
> .../addons/ofxLua/src/luabind/luabind/detail/policy.hpp:534: Macro =
"check" passed 2 arguments, but takes just 1
> .../addons/ofxLua/src/luabind/luabind/object.hpp:1249: Macro "check" =
passed 2 arguments, but takes just 1
> =85

> (and many more)
>=20
> As you can see, I'm using a version of luabind in the ofxLua project, =
but I also tried taking a copy of luabind directly from Git =
(https://github.com/luabind/luabind), but had a similar pile of compile =
errors.  Anyone else run into something similar?  More important, can =
anyone help me with this?
>=20
> Thanks,
> Glen.
>=20
> On Jul 22, 2013, at 2:02 PM, Glen F <[email protected]> wrote:
>=20
>> Hi there, I know this is an old thread...  Was there no follow-up on =
this?=20
>> I've run into the same problem with weak references getting garbage
>> collected when deriving from C++ classes.
>>=20
>> Max's patch hasn't been integrated into luabind, as far as I can =
tell.  I'm
>> happy to fork my own luabind and patch it, but wondering why this was =
not
>> put into the main repo -- was it not judged a correct fix?
>>=20
>> Thanks,
>> Glen.


--Apple-Mail=_B5BAC788-ED0F-4D61-BB1F-D209F2BC40EE
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=windows-1252

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html =
charset=3Dwindows-1252"></head><body style=3D"word-wrap: break-word; =
-webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">How =
embarrassing, sorry for the noise, I was barking up the wrong tree. =
&nbsp;This turned out to be (of course) a stupid change where I was =
including adopt_policy.hpp before luabind.hpp -- =
doh!<div><br></div><div>Sorry.<div><br></div><div>Now, when I try to use =
the adopt policy, I get errors like Sympaval had (in this =
thread:&nbsp;<a =
href=3D"http://lua.2524044.n2.nabble.com/Remove-an-object-from-the-lua-sta=
te-tp7583423p7583425.html">http://lua.2524044.n2.nabble.com/Remove-an-obje=
ct-from-the-lua-state-tp7583423p7583425.html</a>). &nbsp;He didn't =
manage to get adopt working when binding, but rather chose to instead =
use it with using call_function.</div><div><br></div><div>Same as him -- =
I get errors like this, when trying to use adopt(_2) in a =
def():</div><div><br></div><div>.../boost/include/boost/preprocessor/itera=
tion/detail/local.hpp:37:9: No member named 'consumed_args' in =
'luabind::detail::adopt_policy&lt;2, =
void&gt;::only_accepts_nonconst_pointers'</div><div>.../boost/include/boos=
t/preprocessor/iteration/detail/local.hpp:37:9: No member named =
'converter_postcall' in 'luabind::detail::adopt_policy&lt;2, =
void&gt;::only_accepts_nonconst_pointers'</div><div>.../addons/ofxLua/src/=
luabind/luabind/detail/call.hpp:295:48: No member named 'apply' in =
'luabind::detail::adopt_policy&lt;2, =
void&gt;::only_accepts_nonconst_pointers'</div><div><br></div><div>And =
when I try to use it with =
call_function:</div><div><br></div><div>.../addons/ofxLua/src/luabind/luab=
ind/detail/call_function.hpp:200:20: No member named 'match' in =
'luabind::detail::adopt_policy&lt;0, =
void&gt;::only_accepts_nonconst_pointers'</div><div><br></div><div>Is =
this because the latest luabind requires C++0x/C++11 compilation and =
standard libs? &nbsp;Currently, I can't do that because I'm using it =
inside OpenFrameworks v0074, which still uses std::tr1 things -- but I =
guess I can try to change that locally (if that's the solution). =
&nbsp;Or should I go back to an older version of =
luabind?</div><div><br></div><div>Thanks again (though I feel like I'm =
talking to myself ;-),</div><div>Glen.</div><div><br><div><div>On Jul =
22, 2013, at 4:49 PM, Glen Fraser &lt;<a =
href=3D"mailto:[email protected]">[email protected]</a>&gt; =
wrote:</div><br class=3D"Apple-interchange-newline"><blockquote =
type=3D"cite"><meta http-equiv=3D"Content-Type" content=3D"text/html =
charset=3Dus-ascii"><div style=3D"word-wrap: break-word; =
-webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">It =
turns out that the patch does not fix my problem. &nbsp;After more =
web-searching, I see I should be using the adopt policy (<a =
href=3D"http://www.rasterbar.com/products/luabind/docs.html#adopt">http://=
www.rasterbar.com/products/luabind/docs.html#adopt</a>), to pass Lua =
object ownership to C++. &nbsp;However, whenever I try to include =
luabind/adopt_policy.hpp, I get tons of errors (on Xcode 4.6.3 with =
clang or gcc).<div><br></div><div><b>With Clang =
LLVM:</b></div><div>.../addons/ofxLua/src/luabind/luabind/handle.hpp:136:5=
: Expected member name or ';' after declaration =
specifiers</div><div>.../addons/ofxLua/src/luabind/luabind/detail/has_get_=
pointer.hpp:82:3: Declaration does not declare =
anything</div></div></blockquote><blockquote type=3D"cite"><div =
style=3D"word-wrap: break-word; -webkit-nbsp-mode: space; =
-webkit-line-break: after-white-space; =
"><div>=85</div></div></blockquote><br><blockquote type=3D"cite"><div =
style=3D"word-wrap: break-word; -webkit-nbsp-mode: space; =
-webkit-line-break: after-white-space; "><div><b>With LLVM =
GCC:</b></div><div>.../addons/ofxLua/src/luabind/luabind/detail/policy.hpp=
:534: Macro&nbsp;"check" passed 2 arguments, but takes just =
1<br>.../addons/ofxLua/src/luabind/luabind/object.hpp:1249: =
Macro&nbsp;"check" passed 2 arguments, but takes just =
1<br>=85</div></div></blockquote><br><blockquote type=3D"cite"><div =
style=3D"word-wrap: break-word; -webkit-nbsp-mode: space; =
-webkit-line-break: after-white-space; "><div>(and&nbsp;many =
more)</div><div><br></div><div>As you can see, I'm using a version of =
luabind in the ofxLua project, but I also tried taking a copy of luabind =
directly from Git (<a =
href=3D"https://github.com/luabind/luabind">https://github.com/luabind/lua=
bind</a>), but had a similar pile of compile errors. &nbsp;Anyone else =
run into something similar? &nbsp;More important, can anyone help me =
with =
this?</div><div><br></div><div>Thanks,</div><div>Glen.</div><div><br></div=
><div><div><div>On Jul 22, 2013, at 2:02 PM, Glen F &lt;<a =
href=3D"mailto:[email protected]">[email protected]</a>&gt; =
wrote:</div><br class=3D"Apple-interchange-newline"><blockquote =
type=3D"cite">Hi there, I know this is an old thread... &nbsp;Was there =
no follow-up on this? <br>I've run into the same problem with weak =
references getting garbage<br>collected when deriving from C++ =
classes.<br><br>Max's patch hasn't been integrated into luabind, as far =
as I can tell. &nbsp;I'm<br>happy to fork my own luabind and patch it, =
but wondering why this was not<br>put into the main repo -- was it not =
judged a correct =
fix?<br><br>Thanks,<br>Glen.<br></blockquote></div></div></div></blockquot=
e></div><br></div></div></body></html>=

--Apple-Mail=_B5BAC788-ED0F-4D61-BB1F-D209F2BC40EE--


--===============5411429912069254457==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
--===============5411429912069254457==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
luabind-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/luabind-user

--===============5411429912069254457==--