|
Boost : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-01-25 06:48:58
From: "Jens Maurer" <Jens.Maurer_at_[hidden]>
> David Abrahams wrote:
> >
> > Beg pardon, but do function and bind work with extern "C" functions?
> > That would be extremely useful to me.
>
> Unless bind has special precautions to handle "extern C" functions,
> it probably should not work, because an "extern C" function pointer
> and an ordinary "extern C++" function pointer are different types
> language-wise (in particular, different calling conventions might
> apply). I don't believe that linkage specifications are "deduced"
> by template argument deduction.
>
> I agree it would be useful to add the required overloads.
extern "C" function pointers and the C++ function pointers are usually the
same thing. It's not possible to add the overloads when they resolve to the
same type.
The intent for bind is to work with all function pointer types that the
platform recognizes, but the portable implementation cannot do that.
For example, the following fails:
extern "C"
{
typedef void (*pf1)(int);
}
typedef void (*pf2)(int);
void f(pf1)
{
}
void f(pf2)
{
}
I'm not a linkage expert, though, so I might be wrong.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk