Python -builtin fix wrapping constructors with varargs
Fix compilation error when using -builtin and wrapping varargs in constructors Closes #1942
This commit is contained in:
parent
71709af99a
commit
90cdbee6a6
6 changed files with 64 additions and 10 deletions
|
|
@ -126,3 +126,21 @@ struct Extending2 {};
|
|||
struct ExtendingOptArgs1 {};
|
||||
struct ExtendingOptArgs2 {};
|
||||
%}
|
||||
|
||||
// Varargs
|
||||
%warnfilter(SWIGWARN_LANG_VARARGS_KEYWORD) VarargConstructor::VarargConstructor; // Can't wrap varargs with keyword arguments enabled
|
||||
%warnfilter(SWIGWARN_LANG_VARARGS_KEYWORD) VarargConstructor::vararg_method; // Can't wrap varargs with keyword arguments enabled
|
||||
%inline %{
|
||||
struct VarargConstructor {
|
||||
char *str;
|
||||
VarargConstructor(const char *fmt, ...) {
|
||||
str = new char[strlen(fmt) + 1];
|
||||
strcpy(str, fmt);
|
||||
}
|
||||
void vararg_method(const char *fmt, ...) {
|
||||
delete [] str;
|
||||
str = new char[strlen(fmt) + 1];
|
||||
strcpy(str, fmt);
|
||||
}
|
||||
};
|
||||
%}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue