Skip to content

Instantly share code, notes, and snippets.

@malkia
Created January 12, 2012 20:23
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save malkia/1602892 to your computer and use it in GitHub Desktop.
Save malkia/1602892 to your computer and use it in GitHub Desktop.
idea: extend luajit's ffi.cdef so that it can return introspection information
-- Something like (ZeroMQ in this case)
return {
typedefs = {
functions = {
zmq_free_fn = { "void", "data", "hint" },
},
structs = {
zmq_pollitem_t = "zmq_pollitem_t"
},
},
functions = {
zmq_version = { [0]="", "int*", "int*", "int*" }
zmq_errno = { "int" }
}
unions = {
},
structs = {
zmq_msg_t = {
},
},
enums = {
ZMQ_VERSION_MAJOR = 2,
},
}
-- The table above would be returned by ffi.cdef() if asked for it (could be ffi.cdefx, as in extended info)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment