|
在 2011-7-23 晚上11:15,"Mike Pall" <mikelu-1107@mike.de>写道:
>
> Xavier Wang wrote:
> > I see, maybe providing another function to lookup symbols is better ?
> >
> > ffi.lookup("C", "foobar") -- nil, "no such symbol"
>
> Easy enough to add this yourself:
>
> local function plookup(ns, sym) return ns[sym] end
> function ffi.lookup(ns, sym) return pcall(plookup, ns, sym) end
>
> print(ffi.lookup(ffi.C, "foobar"))
>
> --Mike
>
That's easy, thank you Mike :-)