Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mutually dependent typedefs can't be wrapped #119

Open
halleysfifthinc opened this issue Mar 9, 2023 · 0 comments
Open

Mutually dependent typedefs can't be wrapped #119

halleysfifthinc opened this issue Mar 9, 2023 · 0 comments

Comments

@halleysfifthinc
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant