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 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