Discussion:
LuaJIT2.1-alpha question
Maynard, Ed
2014-10-09 20:04:34 UTC
Permalink
I have code that runs on 2.0.3 but under 2.1-a I get a redefine error for structs in my ffi.cdef call the second time I execute the lua package. First time through works great. Clearly something is being cached between those runs - how do I test and/or clear this info?

Thanks in advance,
Ed


This message and any attachments may be a confidential attorney-client communication or otherwise be privileged and confidential. If you are not the intended recipient, any review, distribution or copying of this transmittal is prohibited. If you have received this transmittal in error, please reply by e-mail and delete this message and all attachments.
William Adams
2014-10-09 23:10:05 UTC
Permalink
Yor signature is off putting

Sent from my Windows Phone
________________________________
From: Maynard, Ed<mailto:Ed.Maynard-***@public.gmane.org>
Sent: ‎10/‎9/‎2014 1:05 PM
To: luajit-***@public.gmane.org<mailto:luajit-***@public.gmane.org>
Subject: LuaJIT2.1-alpha question

I have code that runs on 2.0.3 but under 2.1-a I get a redefine error for structs in my ffi.cdef call the second time I execute the lua package. First time through works great. Clearly something is being cached between those runs - how do I test and/or clear this info?

Thanks in advance,
Ed


This message and any attachments may be a confidential attorney-client communication or otherwise be privileged and confidential. If you are not the intended recipient, any review, distribution or copying of this transmittal is prohibited. If you have received this transmittal in error, please reply by e-mail and delete this message and all attachments.
Maynard, Ed
2014-10-09 23:18:44 UTC
Permalink
My apologies for the signature – corporate server must have appended it. Never seen that before. I may have to revert to an outside account.

In the meantime, it appears that this is a well-known issue (redefinition of C structures) without a built-in solution other than creating a new instance of Lua (akin to exit and restart). It also appears that there is no ready way to evaluate whether a variable has been declared or not – no table to look through. I am going to down rev to 2.0.3 where this code “worked” previously; although I am now suspicious of my memory. Another thought is to try and trap the error with the pcall function or something like that.

Thanks in advance and apologies for any additional signature information that may be appended by my company’s server.
Ed



From: luajit-***@freelists.org [mailto:luajit-***@freelists.org] On Behalf Of William Adams
Sent: Thursday, October 9, 2014 5:10 PM
To: ***@freelists.org
Subject: RE: LuaJIT2.1-alpha question

Yor signature is off putting

Sent from my Windows Phone
________________________________
From: Maynard, Ed<mailto:***@tdwilliamson.com>
Sent: ‎10/‎9/‎2014 1:05 PM
To: ***@freelists.org<mailto:***@freelists.org>
Subject: LuaJIT2.1-alpha question

I have code that runs on 2.0.3 but under 2.1-a I get a redefine error for structs in my ffi.cdef call the second time I execute the lua package. First time through works great. Clearly something is being cached between those runs – how do I test and/or clear this info?



Thanks in advance,

Ed

This message and any attachments may be a confidential attorney-client communication or otherwise be privileged and confidential. If you are not the intended recipient, any review, distribution or copying of this transmittal is prohibited. If you have received this transmittal in error, please reply by e-mail and delete this message and all attachments.
Geoff Leyland
2014-10-09 23:28:49 UTC
Permalink
In the meantime, it appears that this is a well-known issue (redefinition of C structures) without a built-in solution other than creating a new instance of Lua (akin to exit and restart). It also appears that there is no ready way to evaluate whether a variable has been declared or not – no table to look through.
Can you just stick the cdefs into a separate file and require it? If C structure definitions are being remembered, surely package.loaded is being remembered as well?
Maynard, Ed
2014-10-10 18:35:56 UTC
Permalink
The 2.0.3 version complains about the redefinition as well. Bad memory on my part. This is the output from 2.1 alpha:

Lua file:

ffi = require("ffi")
local defs = require("mapcdefs") -- this has the cdef statement in it
local hdr = ffi.new("C_mapping_header_t", {})

LuaJIT output:

luajit2.1->dofile("process_mapping.lua")
.\mapcdefs.lua:95: attempt to redefine 'mapping_header_t' at line 8
stack traceback:
[C]: in function 'cdef'
.\mapcdefs.lua:95: in main chunk
[C]: in function 'require'
process_mapping.lua:5: in main chunk
[C]: in function 'dofile'
stdin:1: in main chunk
[C]: at 0x00862190

-----Original Message-----
From: luajit-bounce-***@public.gmane.org [mailto:luajit-bounce-***@public.gmane.org] On Behalf Of Geoff Leyland
Sent: Thursday, October 9, 2014 5:29 PM
To: luajit-***@public.gmane.org
Subject: Re: LuaJIT2.1-alpha question
In the meantime, it appears that this is a well-known issue (redefinition of C structures) without a built-in solution other than creating a new instance of Lua (akin to exit and restart). It also appears that there is no ready way to evaluate whether a variable has been declared or not - no table to look through.
Can you just stick the cdefs into a separate file and require it? If C structure definitions are being remembered, surely package.loaded is being remembered as well?
This message and any attachments may be a confidential attorney-client communication or otherwise be privileged and confidential. If you are not the intended recipient, any review, distribution or copying of this transmittal is prohibited. If you have received this transmittal in error, please reply by e-mail and delete this message and all attachments.
Loading...