diff options
author | Mike Pall <mike> | 2011-11-14 14:15:57 +0100 |
---|---|---|
committer | Mike Pall <mike> | 2011-11-14 14:18:25 +0100 |
commit | 71d00a56dbab6c29c0346093dbe530d7b7608be4 (patch) | |
tree | 5e28e19b4d2f20168d5ee0e4fe500b1e2b233c1c /src/lj_cconv.c | |
parent | e9eb4fdb4a08baaa2d9190187a6c38d5b3f8b091 (diff) | |
download | luajit2-71d00a56dbab6c29c0346093dbe530d7b7608be4.tar.gz |
FFI: Add callback support (for x86/x64).
Diffstat (limited to 'src/lj_cconv.c')
-rw-r--r-- | src/lj_cconv.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/lj_cconv.c b/src/lj_cconv.c index 884edef1..d73984f4 100644 --- a/src/lj_cconv.c +++ b/src/lj_cconv.c @@ -12,6 +12,7 @@ #include "lj_ctype.h" #include "lj_cdata.h" #include "lj_cconv.h" +#include "lj_ccallback.h" /* -- Conversion errors --------------------------------------------------- */ @@ -603,6 +604,13 @@ void lj_cconv_ct_tv(CTState *cts, CType *d, tmpptr = uddata(udataV(o)); } else if (tvislightud(o)) { tmpptr = lightudV(o); + } else if (tvisfunc(o)) { + void *p = lj_ccallback_new(cts, d, funcV(o)); + if (p) { + *(void **)dp = p; + return; + } + goto err_conv; } else { err_conv: cconv_err_convtv(cts, d, o, flags); |