Hi, I'm forwarding this to the Macaulay2 list, since at Sage Days 14 (?), Dan Grayson's project was to embed Sage into Macaulay2. He was extremely successful at doing this, and showed us some cool demos as a result. Maybe he can make some comments.
William On Thu, Feb 11, 2010 at 4:28 PM, Burcin Erocal <[email protected]> wrote: > Hi, > > I'm in Kaiserslautern, at a workshop on connecting mathematical > software for polyhedral geometry with software packages for Gröbner > basis (polymake, gfan, singular). > > I tried to code a small example demonstrating how to call Sage from > other C programs. I have a Cython module with the following: > > import sage.all > from sage.rings.arith import factor > > cdef public do_something_in_sage(int** res, int n): > print "do_something_in_sage called, input:",n > t = factor(n) > print t > > > Now I want to link/load this as a C library. It seems that initializing > Python with > > Py_Initialize(); > PySys_SetArgv(1, argv); > > then importing the module with > > PyObject* sage_module = PyImport_ImportModule("sage_link"); > > doesn't quite work. Python decides to include the directory > $SAGE_LOCAL/lib64/python2.6/lib-dynload/ instead of > $SAGE_LOCAL/lib/python2.6/lib-dynload/ (Note lib64 vs. lib). If I add > the latter to sys.path manually, things work as expected. > > Does anyone know where this lib64/lib problem comes from? > > Is it possible to avoid having to import the Cython module? Or to make > the necessary blurb to call cython functions less scary? > > > You can find the latest version of my attempts here: > > http://sage.math.washington.edu/home/burcin/sage_link/ > > > Thank you. > > Burcin > > -- > To post to this group, send an email to [email protected] > To unsubscribe from this group, send an email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/sage-devel > URL: http://www.sagemath.org > -- William Stein Associate Professor of Mathematics University of Washington http://wstein.org -- To post to this group, send an email to [email protected] To unsubscribe from this group, send an email to [email protected] For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
