Here is the typemap for anyone with a similar problem:
/* Typemap suite for (DATA_TYPE* INPLACE_ARRAY1)
*/
%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
fragment="NumPy_Macros")
(DATA_TYPE* INPLACE_ARRAY1)
{
$1 = is_array($input) && PyArray_EquivTypenums(array_type($input),
OK yeah, I tested with float data_location[] but then it expects and
array of length 0, (shape [0] it says). With float data_location[64] I
can use 64 size array but this isn't very useful in this instance. I
will try and make a typemap for just (float* INPLACE_ARRAY) without a
DIM1 as that's proba
Yes, typemaps are checked against individual arguments or contiguous groups of
arguments, not necessarily the entire argument list.
I believe the argument would have to be "float data_location[]", signifying a
null-terminated array, rather than float*, for the INPLACE_ARRAY1[ANY] to work.
On No
Cool! That seems to have worked. Many thanks. So I didn't need my own
typemap for this at all as it will already ignore the rest of the
arguments?
What I still don't understand is that there seems to be a typemap for
INPLACE_ARRAY1[ANY] without any DIM1. How come I can't apply that?
> Be sure yo
I think you are getting close. Application of the typemap simply requires
%apply (float* INPLACE_ARRAY1, int DIM1) {(float* data_location, int
unused)}
rather than the entire argument list.
Be sure you understand the use case. The (data_location, unused) pair is going
to be provided by a
Hi Bill,
thanks for your response. So the function I am actually trying to wrap is:
static inline void
lilv_instance_connect_port(LilvInstance* instance,
uint32_t port_index,
void* data_location)
It just passes on the pointer to
Kaspar,
Yes, in order for numpy.i typemaps to work, you need to provide dimensions.
How is lilv_test(float*) supposed to know how large the float array is? Is it
actually a method where the class knows the size? In cases where dimensions
are not passed through the argument list, you have two