On Thu, Feb 18, 2010 at 5:22 AM, Nathann Cohen <nathann.co...@gmail.com> wrote:
> Hello everybody !!!!
>
> I have been spending hours on the same Cython problem, which I hope
> you can solve instantly :-)
>
> I have a Cython file, which happens to be sage/numerical/mip_coin.pyx
> which defines the following function :
>
> cdef float osi_solve(self,c_OsiSolverInterface * si,bool log,bool
> objective_only)
>
> I would like to use this function outside of mip_coin, so I wrote in
> this other file :
>
> cimport sage.numerical.mip_coin
> from mip_coin cimport osi_solve
>
> Well, everything seems to be fine in this other module, though when
> Sage compiles mip_coin.pyx, it looks at its .pxd file and notices the
> following line :
>
> cdef float osi_solve(self,c_OsiSolverInterface * si,bool log,bool
> objective_only)
>
> Well, this is (I hope) perfectly normal. As I want to be able to use
> this function outside, I have to declare it in the .pxd... But then
> Cython tell me the following thing :
>
> /usr/local/sage/devel/sage-cplex/sage/numerical/mip_coin.pxd:88:20:
> Non-extern C function 'osi_solve' declared but not defined
>
> So it sounds like Sage does not find the declaration of osi_solve even
> though it is made in mip_coin.pyx
>
> Please, tell me that you know where it comes from :-)

Whenever I've run into the above shortcoming in how Python extension
modules worked, I've made a class that provides that method as a
cdef'd method, then instantiated the class.

You should email cython-devel about this, by the way.

 -- William

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to