See, i tell u, nothing is difficult in this world.

I achieved the thing which i was asking for.

Thanks for the advice.

I used this paper:
http://www.swig.org/tutorial.html

for creating python modules from C code.

Which is what i needed. In order to interface both things, we need
convert atleast one thing to other so i choosed to convert C code to
python module.

The steps which i followed were:
These steps were to create a python module from C code. So a mandatory
condition for .c file is : it should not have main function, and any
variable in any function called from main function should be declared
global.

1. Creating wrapper from .i :
swig -python TestCase.i (where TestCase.i is interface file containing
declarations of functions and variables)
2. Creating .o's :
 gcc -c TestCase.c TestCase_wrap.c (TestCase_wrap.c is file genereted
by swig and is a wrapper for creating a python module)
3. Shared Library:
 ld -shared TestCase.o TestCase_wrap.o TestCase.so

Module was inserted as:
1. export LD_LIBRARY_PATH=$PWD:$LD_LIBRARY_PATH
2. python Tc.py
( In this python file i did: "import TestCase" and then used it as
"TestCase.main_module()"

**********************************

So, we don't need to write any code to do this.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to