Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-06-04 13:33:29


From: "Dirk Gerrits" <dirkg_at_[hidden]>
> From: "Peter Dimov" <pdimov_at_[hidden]>
>
> > From: "David Abrahams" <david.abrahams_at_[hidden]>
> > > From: "Peter Dimov" <pdimov_at_[hidden]>
> > >
> > > I know that. I just wanted the same kind of "extra" facility you could
> > > request for __stdcall. In other words, for the platforms where it's
> > needed,
> > > #include <boost/bind/extern_c.hpp>.
> >
> > There is no way to supply the overload. extern "C" is not allowed on
> > parameter declarations AFAIK; the "qsort" way is to use an intermediate
> > typedef
>
> I have no idea what intermediate typedef trickery you are referring to, so
> forgive me if I say something stupid.

Apologies for the highly compressed writing style.

What I meant was that you can declare a pointer to an extern "C" function
using a typedef:

extern "C"
{
    typedef void (*pf) ();
}

and then use this pointer as an argument:

void g(pf f); // 'g' is not extern "C" itself

but you can't do

void g(extern "C" void (*f) ());

Since bind uses overloads of the form

template<class R> ... bind(R (*f) ());

the typedef trick doesn't work.

> > but we don't have typedef templates, alas.
>
> There's a workaround which mimics typedef templates. Can't this be used
> here?

Unfortunately not.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk