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

Wrapping a const function that returns a pointer #136

Open
kennyweiss opened this issue May 9, 2020 · 1 comment
Open

Wrapping a const function that returns a pointer #136

kennyweiss opened this issue May 9, 2020 · 1 comment

Comments

@kennyweiss
Copy link
Member

In the references example, there is the following case:

  - decl: double* getArray() +dimension(getSize())

I ran into a problem wrapping the function if it is const, e.g.

  - decl: double* getArray() const +dimension(getSize())

The errors were of the form:

<src>.cpp: error: a value of type "const ArrayWrapper *" cannot be used to initialize an entity of type "ArrayWrapper *"
      ArrayWrapper *obj = static_cast<const ArrayWrapper *>(self->addr);

Could you please add the const versions of these functions, with shroud wrappers?

@ltaylor16
Copy link
Member

I added the test on the arraywrapper4 branch. However, I was getting a different error from the Fortran wrapper:

Argument 'dshc_rv' of pure function 'c_arraywrapper_get_array_const_bufferify' at (1) must be INTENT(IN) or VALUE

Try out the branch in your library. I'll add a few more cases like making the result const:

- decl: const double* getArray() +dimension(getSize())

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

2 participants