I am trying to wrap the c ++ function with signature
vector & Lt; Unsigned long & gt; Optimized_Atrostenews_sivian (unsigned long MAX) using the statement. I have to run a file that has to run a function, a static library. And my setup.py is as follows: from distutils.core import from distutils.core import setup Extension Import Extension Distributes from Cython Import build_ext ext_modules = [Extensions ("Sieve", ["sieve.pyx"], language = 'C ++', extra_objects = ["sieve.a"],)] Setup (name = ' Sieve ', CMDClass = {' Build_ext ': build_ext}, ext_modules = ext_modules) In my sieve.py I am trying to:
Libcpp.vector cimport vector "sieve.h" from cdef extern: vector [unsigned long] optimized_Eratosthenes_sieve (unsigned long max) def oes (unsigned long A): return optimized_Eratosthenes_sieve (a) # this error occurs But I am getting this "vector" error "can not be converted" into the Python object, am I missing something?
Solution: I have to return a dragon object from my OAS function: DEF OAS (unsigned long A): CDF vector [unsigned long] Aa cdef int nb = [] aa = Optimized_Eratosthenes_sieve (a) N = aa.size () for the range i ) In: b.append (aa [i]) #Vector creates a list from return b cdef
Instead of def . On the other hand, if you have to call it a python, then your function will need to return a python object. In this case, you probably will return it to a python list of integers.
Comments
Post a Comment