summaryrefslogtreecommitdiff
path: root/Examples/test-suite/string_simple.i
blob: 537daa570057038d7e75b00e85941542025b4794 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
%module string_simple

%newobject copy_str;

%inline %{
#include <string.h>
const char* copy_str(const char* str) {
  size_t len = strlen(str);
  char* newstring = (char*) malloc(len + 1);
  strcpy(newstring, str);
  return newstring;
}
%}