wrapping functions with variadic-parameter wrappers

Gor Gyolchanyan gor.f.gyolchanyan at gmail.com
Wed Dec 5 02:01:04 PST 2012


What's the best (least overhead and most portable and safe) way wrapping a
function into a variadic-parameter function?

For instance:

long foo(int i, char c)
{
   /// ...
}

long bar(...)
{
    return foo(/* ??? */);
}

This is necessary for losing the parameter types, but still having the
function callable with its expected parameters. I suspect this could be
done using inline assembler and knowledge of the D ABI to achieve near-zero
overhead.

The wrapper can include dynamic type checking using the automatically
passed _arguments array to ensure type safety.

This is useful for dynamic dispatching.

-- 
Bye,
Gor Gyolchanyan.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20121205/a51191b3/attachment.html>


More information about the Digitalmars-d mailing list