diff options
Diffstat (limited to 'Examples/test-suite/char_binary.i')
-rw-r--r-- | Examples/test-suite/char_binary.i | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/Examples/test-suite/char_binary.i b/Examples/test-suite/char_binary.i new file mode 100644 index 000000000..778792946 --- /dev/null +++ b/Examples/test-suite/char_binary.i @@ -0,0 +1,29 @@ +/* +A test case for testing non null terminated char pointers. +*/ + +%module char_binary + +%apply (char *STRING, size_t LENGTH) { (const char *str, size_t len) } + +%inline %{ +struct Test { + size_t strlen(const char *str, size_t len) { + return len; + } +}; + +typedef char namet[5]; +namet var_namet; + +typedef char* pchar; +pchar var_pchar; +%} + +// Remove string handling typemaps and treat as pointer +%typemap(freearg) SWIGTYPE * "" +%apply SWIGTYPE * { char * } + +%include "carrays.i" +%array_functions(char, pchar); + |