Skip to content

Mutually dependent typedefs can't be wrapped #119

@halleysfifthinc

Description

@halleysfifthinc

A library I'm working to wrap has a StaticArrays.jl equivalent functionality, with template Vec and Row classes. Both the classes define a transpose function to return the vec/row as it's transposed type:

template<int N, typename T> class Vec;
template<int N, typename T> class Row;

template<int N, typename T>
class Vec
{
  public:
  typedef Row<N,T> Transp;

  const Transp& transpose()    const { return *reinterpret_cast<const Transp*>(this); }

/* further definitions omitted */
};

with the same for the Row class definition. A wrapper including both types (see gist for complete MWE) compiles with no errors, but loading it in Julia throws an error:

"C++ exception while wrapping module jlsimbody: No appropriate factory for type N9paramtest3RowILi3EiEE
ERROR: No appropriate factory for type N9paramtest3RowILi3EiEE"

As both types do exist/are wrapped, this seems to be an order of declaration/wrapping issue, since the type for Row<3,int> hasn't been wrapped when the transpose method for Vec<3,int> is added?

I don't know what (or if) there is a solution to be had besides not wrapping the offending methods; at the very least, could the error be made more relevant?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions