lua-users home
lua-l archive

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

On Fri, Jan 08, 2010 at 11:16:58AM -0200, Roberto Ierusalimschy wrote:
> That is why we never get rid of this warning. Any trick will only make
> things worse. This is a Posix function used in the way it is intended to
> be used. Too bad that C does not have proper support for it.

For aranha, I used something along the lines of:

void *symbol = dlsym(modhandle, funcname);
if (symbol != NULL) {
    lua_pushcclosure(L, *(lua_CFunction*)(void *)&symbol, 0);
    lua_pushboolean(L, module_system_forked);
    lua_pcall(L, 1, 0, 0);

I'll admit that the casting chain isn't pretty; but it is reliable as far as I
can tell.


Daniel Silverstone               
PGP mail accepted and encouraged.            Key Id: 3CCE BABE 206C 3B69