|
Boost : |
From: Rene Rivera (grafik.list_at_[hidden])
Date: 2005-05-20 09:34:31
In rewriting a plugin interface I use, which for language portability
uses C function pointers as the entry points, I came up with a
"make_c_function" utility. I use it to translate C++ functions, any of
objects, binds, function, members, et. to _real_ C function pointers.
For example:
class P
{
public: int foo(int);
};
P p;
extern "C"
{
void * get_plugin_call(int n)
{
if (1 == n)
{
return make_c_function<P,int(int)>(
boost::bind(&p,p::foo,_1));
}
else { return 0; }
}
}
[example much abbreviated from real life use]
-- -- Grafik - Don't Assume Anything -- Redshift Software, Inc. - http://redshift-software.com -- rrivera/acm.org - grafik/redshift-software.com -- 102708583/icq - grafikrobot/aim - Grafik/jabber.org
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk