integer type conversion problem/question

Josiah Carlson jcarlson at uci.edu
Sat Oct 9 16:56:29 EDT 2004


> I'd looked at this earlier, but they didn't seem to have implemented a C 
> API. If there is one, I haven't been able to find it in 
> http://python.org/doc/2.3.4/api/api.html or anywhere else. I don't want to 
> import Python code into C/C++ even if that is possible. I think it is 
> easiest to work with a straight C/C++ library and interface it with 
> Python, assuming that I don't run into type conversion issues.

So what you are saying is that you have some C code that needs to use
random numbers, and that some higher-level Python module uses the output
from your module.

> A random number C module does exist in Python 2.3. On my system (Debian 
> Sarge) it is /usr/lib/python2.3/lib-dynload/_random.so. However, it is 
> probably not set up to be directly accessed from C/C++ code.

I would suggest borrowing the necessary parts of _random.c, and call it
good.  It is available via CVS in src/Modules .


 - Josiah




More information about the Python-list mailing list