%module template_typedef_funcptr //Bug #1832613 #if !defined(SWIGR) // R Swig fails on this test. Because it tries to return a nil SEXP in // an error %include %inline %{ #include template class Ptr {}; class MCContract {}; typedef Ptr MCContractPtr; %} %template() Ptr; %inline %{ template class ContractFactory { public: static ContractFactory &getInstance() { static ContractFactory instance; return instance; } }; /** * CreateXXContractCallback is a pointer to a function taking no arguments and * returning a pointer to an XXContract. */ typedef MCContractPtr (*CreateMCContractCallback)(); %} //Get around it by changing this: %template(MCContractFactory) ContractFactory; //to a form which expands the typedef: //%template(MCContractFactory) ContractFactory(*)()>; %inline %{ typedef MCContractPtr* ContractPtrPtr; %} // Plain pointers were also causing problems... %template(MCContractFactory2) ContractFactory; #endif