Fix C code where a typedef name was used for constructor and destructor names in %extend. Deprecate use of typedef names for constructor and destructor names going forwards.
This commit is contained in:
parent
2435b98a24
commit
d1b40b468b
6 changed files with 65 additions and 2 deletions
|
|
@ -33,3 +33,28 @@ typedef struct StructD StructDName;
|
|||
void method() {}
|
||||
}
|
||||
|
||||
|
||||
typedef struct stru_struct {
|
||||
int bar;
|
||||
} stru;
|
||||
typedef union uni_union {
|
||||
int un1;
|
||||
double un2;
|
||||
} uni;
|
||||
|
||||
%extend stru {
|
||||
stru() {
|
||||
stru* s = (stru*)malloc(sizeof(stru));
|
||||
s->bar = 11;
|
||||
return s;
|
||||
}
|
||||
~stru() {
|
||||
free($self);
|
||||
}
|
||||
}
|
||||
|
||||
%extend uni {
|
||||
uni() { return 0; }
|
||||
~uni() { free($self); }
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue