Skip to content

Instantly share code, notes, and snippets.

@autosquid
Created January 25, 2017 08:46
Show Gist options
  • Save autosquid/3aa5fbcca8d0a587ca57197d358c15a6 to your computer and use it in GitHub Desktop.
Save autosquid/3aa5fbcca8d0a587ca57197d358c15a6 to your computer and use it in GitHub Desktop.
swig pitfalls
%typemap(argout) std::vector<tex::TextureView>* {
/* { the last parameter is "whether python own the object behind the pointer" */
/* in this case: $1 is points to `temp`, managed by vector, so python does not own it */
/* to return something python own, we need to `new` a object */
/* so instead of the following */
/* $result = swig::from_ptr($1, 1); */
/* we use: }*/
$result = swig::from(*$1);
}
/* %include "tex/generate_texture_views.h" ---- we do not need this for namespace tangling difficulty for swig*/
void generate_texture_views(std::string const & , std::vector<tex::TextureView> *);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment