typemap to fix conversion from python strings to uint8_t*
This commit is contained in:
parent
4bd2fc9e72
commit
eba8ecc6c3
1 changed files with 11 additions and 2 deletions
|
|
@ -1,7 +1,16 @@
|
||||||
%module hammer
|
%module hammer
|
||||||
|
|
||||||
%include "typemaps.i"
|
|
||||||
%include "stdint.i"
|
%include "stdint.i"
|
||||||
|
%include "typemaps.i"
|
||||||
|
%apply char [ANY] { uint8_t [ANY] };
|
||||||
|
|
||||||
|
#if defined(SWIGPYTHON)
|
||||||
|
%typemap(in) uint8_t* {
|
||||||
|
$1 = (uint8_t*)PyString_AsString($input);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
#warning no "in" typemap defined
|
||||||
|
#endif
|
||||||
|
|
||||||
// All the include paths are relative to the build, i.e., ../../. If you need to build these manually (i.e., not with scons), keep that in mind.
|
// All the include paths are relative to the build, i.e., ../../. If you need to build these manually (i.e., not with scons), keep that in mind.
|
||||||
%{
|
%{
|
||||||
|
|
@ -12,5 +21,5 @@
|
||||||
%include "allocator.h"
|
%include "allocator.h"
|
||||||
%include "hammer.h"
|
%include "hammer.h"
|
||||||
|
|
||||||
%apply const char* { const uint8_t* }
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue