Skip to content

Keeping underlying Fortran-contiguous ndarray buffer valid on return from C++ code #313

Closed Answered by wjakob
Chronum94 asked this question in Q&A
Discussion options

You must be logged in to vote

Two ways to do this: modify your MatrixObject to stash the nb::ndarray somewhere. Or use a keep_alive call annotation to ensure that the argument (a) is kept alive at least as long as the return value of the function.

Replies: 2 comments 24 replies

Comment options

You must be logged in to vote
1 reply
@Chronum94
Comment options

Answer selected by Chronum94
Comment options

You must be logged in to vote
23 replies
@wjakob
Comment options

@Chronum94
Comment options

@wjakob
Comment options

@Chronum94
Comment options

@wjakob
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants