Use malloc instead of new in C mode.
Add #includes needed by some SWIG code. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@8426 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
acee51f66a
commit
fdd0088a30
1 changed files with 9 additions and 0 deletions
|
|
@ -138,7 +138,14 @@ SWIG_TYPECHECK_STRING_ARRAY 1140
|
|||
float, double, long double, char *, void *, void,
|
||||
enum SWIGTYPE, SWIGTYPE *,
|
||||
SWIGTYPE[ANY], SWIGTYPE & "$result = $1;";
|
||||
#ifdef __cplusplus
|
||||
%typemap(out) SWIGTYPE "$result = new $1_type($1);";
|
||||
#else
|
||||
%typemap(out) SWIGTYPE {
|
||||
$result = ($&1_ltype) malloc(sizeof($1_type));
|
||||
memmove($result, &$1, sizeof($1_type));
|
||||
}
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
// UCS-2 string conversion
|
||||
|
|
@ -484,4 +491,6 @@ $body)"
|
|||
|
||||
#define EXPORT EXTERN SWIGEXPORT
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
%}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue