lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]



在 2011-7-23 晚上11:03,"Mike Pall" <mikelu-1107@mike.de>写道:
>
> Xavier Wang wrote:
> > Is that difficult to make unresolved function name become nil?
> > ffi.C.foobar --> nil
>
> That's not difficult. But there would be no way you could get the
> error message then (a table lookup can only return one result).
> And you'd have to litter your code with asserts. It makes more
> sense to error out here. For a C program you'll get an error when
> the static or dynamic linker fails to resolve a symbol, too.
>

I see, maybe providing another function to lookup symbols is better ?

ffi.lookup("C", "foobar") -- nil, "no such symbol"

> --Mike
>