Here is how it goes now:

First, I put this file in directory config:

Macintosh:fbld johnskaller$ cat config/python.fpc
Name: Python
cflags: -I/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/ 
Python.framework/Versions/2.5/include/python2.5/
includes: "Python.h"
requires_dlibs: -L/Developer/SDKs/MacOSX10.5.sdk/usr/lib/ 
libpython2.5.dylib -lpython2.5

This is for Mac OSX 10.5, using the system Python. Next, here is the  
test program:

Macintosh:fbld johnskaller$ cat pytest.flx
requires package "Python";

type PyObject = "PyObject*";
proc Py_INCREF: PyObject = "Py_INCREF($1);";

cfun mypy(self:PyObject, x:PyObject): PyObject = {
   Py_INCREF(x);
   return x;
}

export python fun mypy of (PyObject * PyObject) as "MyPy";
println "HI";

And here we build using Felix:

Macintosh:fbld johnskaller$ bin/flx --test --force pytest.flx
HI

So the library can still be executed as a Felix program. And from  
Python:

Macintosh:fbld johnskaller$ /usr/bin/python2.5
Python 2.5.1 (r251:54863, Jan 17 2008, 19:35:17)
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
 >>> import pytest
 >>> x = pytest.MyPy(10)
 >>> print x
(10,)

..which is exactly right! Here is an excerpt from the generated C++:

static PyMethodDef pytest_methods [] = {
   {"MyPy", mypy, METH_VARARGS, "./pytest.flx: line 11, cols 1 to 58"},
   {NULL, NULL, 0, NULL}
};
PyMODINIT_FUNC initpytest() { Py_InitModule("pytest", pytest_methods);}

--
john skaller
[EMAIL PROTECTED]





-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to