-
Notifications
You must be signed in to change notification settings - Fork 81
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
dialect::dimensions object's contents not accessible from python swig wrapper #50
Comments
FYI, I have managed to build an example python3 extension of code with the same signature as There seems to be no need to use |
Still stuck, If I insert:
into AttributeError: module '_adaptagrams' has no attribute 'dimensions_first_get' when I import from anything from adaptagrams.py post-compilation. |
Hi, unfortunately it's been ages since I did anything with SWIG, and it will be a long time before I could give this any serious attention. Hopefully someone else can help. If I do think of anything I will chime in. Good luck! |
Thanks for your reply @skieffer. It's a really strange issue, since the isolated case seems to work as expected. it may be the case that the order of one of the other declarations is interfering with the expected outcome. Swig isn't being too helpful about this... let's see.. In any case, it's not the end of the world if it isn't resolved since one can read/write from the |
I have asked for advice on this issue over at stackoverflow |
I probably would consider pybind11 instead swig. Slightly more modern
solution.
ti 25. toukok. 2021 klo 15.41 Shakeeb Alireza ***@***.***>
kirjoitti:
… I have asked for advice on this issue over at stackoverflow
<https://stackoverflow.com/questions/67671475/unable-to-access-a-typedef-defined-stdpairdouble-double-from-its-python-swig>
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#50 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAKORMKRK62TFRFCRQJKNITTPOLHZANCNFSM45KA2SFA>
.
|
@jtiai I'm just a user of the library. (-: I think the benefit of SWIG is the automated wrapping, Cython, pybind11 and cffi are manual wrapping tools. I've personally only had experience with cython previously but I hear pybind11 is a good option for c++ |
I actually have wrapped part of libavoid with pybind11. Wasn't much of a work. |
@jtiai the missing part of the swig interface in this case is really trivial and tiny: just a std::pair<double,double> and it's just ridiculously weird that swig will generate the code but won't enable it. I've moved the declaration all over the Now I'm just irritated about not finding a solution, and having exhausted my own attempts, so I've just posted it on the swig forum in case there's an expert out there who can shed light on this problem: https://sourceforge.net/p/swig/mailman/message/37289720/ S |
I took @jtiai's advice and wrapped up the part I wanted (HOLA in @skieffer In case someone else finds this useful, I put the work in a GitHub repo. The S |
As a followup to the above: there is now a project repo for the pybind11 wrapper: pyhola In practice it seems to perform somewhat consistently with the swig wrapper and holds its own against other algorithms. |
@shakfu, thanks for your work with Your layout comparison is interesting. I wonder why the Also the network seems to be (almost?) a tree. Is the "speaker" box connected twice to its neighbor? If so, are ports being used, to model a multigraph? It would be interesting to see how it performed with a network that had more non-tree structure. |
Hi @skieffer Thanks for your reply.
The underlying graph is the same but the differences in layout may be because the adaptagrams libs I use to build This motivated me to add a basic cmake build system which you have commented on in another post.
In Max/MSP objects have inlets and outlets. The Note that the layout comparison compares only node position layout, edges are not yet considered. I would like progress in that direction but my initial pybind11 wrapper was a bit limited. This pushed me to try to wrap all of the adaptagram libs via an automatic binder generation tool. This is working surprisingly well, but as before, it makes no sense to do so with old adaptagrams libs... and hence more justification for the cmake project.. |
Hi,
The python swig wrapper works great except that I am unable to access the contents of the
dimensions
objects which is astd::pair<double, double>
instance return from DialectNode.getDimensions.dialect::dimensions
is atypedef std::pair<double,double> dimensions
But I am not able to retrieve its contents in python.
I have tried to add some additional wrapping code to
adaptagrams.i
. The following gives the same error as above:and when I add a
%template(dimensions) std::pair<double,double>;
it generates the wrapping code but then cannot find it in the resultant extension module.My knowledge of SWIG is quite limited so would appreciate some advice on how to fix this.
The text was updated successfully, but these errors were encountered: