Re: function to check if a symbol in a library exists or not

  • From: malkia <malkia@xxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Wed, 1 Aug 2012 02:29:55 -0700

I preffer the exceptions - not declared, not found, etc.

When using ffi I want to feel more strict rules, because we are dealing at
lower level, almost as C

Another provlem is if you have to provide an ffi c function as callback to
another c function

If the function is missing, and luajit/ffi not throwing exceptions, but
simply returns nil, then that's a problem
On Aug 1, 2012 12:53 AM, "Cosmin Apreutesei" <cosmin.apreutesei@xxxxxxxxx>

> So in the end, wouldn't it be easier/cleaner/more Lua-like to return
> nil for missing symbols than raise and exception and forget about all
> these pcall/dlsysm/getprocaddress hacks? After all, this is how Lua
> behaves for normal modules and nobody seem to mind. And you could
> always wrap a ffi module with a proxy table if you want error checking
> ala strict.lua.
> The only objection I heard so far to this is symbols which resolve to
> null but can someone confirm that they actually resolve to nil and not
> null cdata? And even if they were, I don't see a problem with that
> ambiguity anyway.

Other related posts: