I’m looking to declare the type of an extern “C” function pointer. It is a member variable. The syntax in this question I cannot get to compile.
template<typename Sig> struct extern_c_fp {
extern "C" typedef typename std::add_pointer<Sig>::type func_ptr_type;
};
I have experimented with placing the extern "C" at both ends, and between typedef and typename and between type and func_ptr_type, but the compiler rejected all. Any suggestions?
This doesn’t use the same interface as you use, but there may be a way to extract the return type and argument types of
Sig.This works in clang 3.1. Xeo pointed out it didn’t work in GCC. I’m not sure if this is a bug in either compiler, so be careful when using this.