-
Notifications
You must be signed in to change notification settings - Fork 84
unable to convert argument ... #34
Comments
|
Except when it is :p |
OK so the following works for me with lua 5.2 on OSX.
So the question is why does it not work for you...
After the cdef call. |
Okay.... (damn, github cut off the file..... can I email it to you? what addr?) |
So it is indeed getting confused. I wonder if its getting confused with the first reference being circular. |
OK so first off there is two typedef struct {...} __sigset_t (line 99 and 1109), which is illegal C. The parser should be erroring on that. Otherwise this is a case of types (including function types) created between the first and second __sigset_t typedef use the first definition, but later types and your use of ffi.new use the second definition. For now get rid of the double definitions. The bug in luaffi is to then error on the second definition. |
Ah okay; I hadn't noticed I had duplicate declarations. somehow luajit didn't seem to choke: maybe because they were identical declarations? Thanks :) |
I'm very loathe to allowing duplicate definitions. Strictly speaking duplicates aren't allowed by the FFI API, it's just luajit has a implementation detail at the moment where it doesn't error, but that doesn't preclude it from erring in the future. From the FFI semantics page: Also, this is not a validating C parser. It expects and accepts correctly formed C declarations, but it may choose to ignore bad declarations or show rather generic error messages. If in doubt, please check the input against your favorite C compiler. |
I'm having trouble reducing to a small test case, but things work fine under luajit.
When running the code:
I get the error:
unable to convert argument 1 from cdata<struct 61[1]> to cdata<struct 26*>
sigemptyset is declared via:
though the trailing attributes don't seem to matter
The text was updated successfully, but these errors were encountered: