discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] Q's regarding C++ <-> SWIG <-> Python


From: Michael Dickens
Subject: Re: [Discuss-gnuradio] Q's regarding C++ <-> SWIG <-> Python
Date: Sun, 9 Jul 2006 10:26:01 -0400

Yes yes, standard C++ ;-)  In the context of how SWIG interprets the
declarations for the friend method(s), that's my question.  I tried
having the last 3 arguments of the friend method have defaults (of 7,
so 4 required, 3 optional), but then the instantiation from Python
doesn't work.  Could be that I messed up something else along the
way, but this was the last change I made (removing the 3 default
values) and -poof- things worked again.

Should work OK.  Be sure that the C++ .h and the .i files agree.

Yup. This works OK now .. it was the probably the multiple constructors which were the primary problem ... could have had other issues as well.

Yes, you can have multiple constructors, but they need to have
different names.  (If they have the same name, C++ can sort them out
at compile time based on argument type at the calling site, but Python
can't do that because of its dynamic typing.)

Ah, so just name the friend method differently than that of the
"default" friend method?  Hmmm, I'll try that tomorrow when I have a
chance.  Clearly for a given C++ class, the constructor names will be
the same but with different arguments ... so the difference has to
come in the friend naming.  I would guess it would require it's own
GR_SWIG_BLOCK_MAGIC stuff too, with the different friend name?

The second constructor will require a subset of what's in
GR_SWIG_BLOCK_MAGIC.  Probably just the renaming part.

OK.  I'll look into it. - MLD




reply via email to

[Prev in Thread] Current Thread [Next in Thread]