template <typename T>struct alignas(64) dataStruct {uint32_t nx;uint32_t ny;}cdef cppclass dataStruct:
uint32_t nx
uint32_t nyYou don't need to worry about declaring this in the Cython file; all
that's needed is the types and names of the members in the struct such
that Cython can generate the correct access code when it generates the
C file. (After Cython generates the C code, it is passed off to a
C[++] compiler that will read the actual header definitions and do the
right thing.)
On Wed, Jun 26, 2019 at 4:18 PM Nikhil Garg <nikhil...@gmail.com> wrote:
>
> I am currently working on wrapping a c++ library. Within this library, there is a struct defined with c++ alignas keyword. I would like to know whether it is possible to specify that within cython.
>
> https://en.cppreference.com/w/c/language/_Alignas
>
> template <typename T>
> struct alignas(64) dataStruct {
> uint32_t nx;
> uint32_t ny;
> }
>
> I tried to translate it into cython, however, i am not sure what the syntax would be or should I just ignore putting alignas
>
> cdef cppclass dataStruct:
> uint32_t nx
> uint32_t ny
>
>
> I am not sure about the reasons for c++ to use alignas, but I need this struct to be present in cython wrapper, therefore, would like to know a possible way of mapping it.
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups "cython-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to cython...@googlegroups.com.