[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lua-l
Subject:    Re: Help writing my first Lua C module
From:       liam mail <liam.list () googlemail ! com>
Date:       2013-09-30 12:40:23
Message-ID: CAOMMs2Tw+=_B0mvy_1+2PdOrCJs-GmU00rOg6Yv4ZOKEbq3=Ug () mail ! gmail ! com
[Download RAW message or body]

On 30 September 2013 12:56, Roberto Ierusalimschy <roberto@inf.puc-rio.br>wrote:

> > Lua cannot represent or use a generic function pointer on the Lua
> > side (other than as a void pointer), [...]
>
> Lua 5.2 can, with a light C function. (Of course, you should never expose
> that value to any Lua code that could try to call it.)
>
> -- Roberto
>
>
I have hidden none lua_CFunctions in Lua before just by casting it to the
expected signature, when I needed to call in C I recast it to the correct
type and called it; which is perfectly valid C. Casting to a void pointer
is however either undefined or implementation defined.

--Liam

[Attachment #3 (text/html)]

<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On 30 \
September 2013 12:56, Roberto Ierusalimschy <span dir="ltr">&lt;<a \
href="mailto:roberto@inf.puc-rio.br" \
target="_blank">roberto@inf.puc-rio.br</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div class="im">&gt; Lua cannot represent or use a generic \
function pointer on the Lua<br> </div>&gt; side (other than as a void pointer), \
[...]<br> <br>
Lua 5.2 can, with a light C function. (Of course, you should never expose<br>
that value to any Lua code that could try to call it.)<br>
<span class="HOEnZb"><font color="#888888"><br>
-- Roberto<br>
<br>
</font></span></blockquote></div><br></div><div class="gmail_extra">I have hidden \
none lua_CFunctions in Lua before just by casting it to the expected signature, when \
I needed to call in C I recast it to the correct type and called it; which is \
perfectly valid C. Casting to a void pointer is however either undefined or \
implementation defined.</div>

<div class="gmail_extra"><br></div><div class="gmail_extra">--Liam</div></div>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic