I am trying to write a c routine to speed up a python script.
In order to route prove my method I first wrote a short test c function and compiled it into a library: the code for the test function is:
void cttest(void);
#include <stdio.h>
void cttest()
{
printf("This is the shared module|n");
return;
}
I saved this code into a file 'ct_test.cc'.
I then compiled this code as follows:
g++ -shared -fPIC -o /home/paula/libs/libcttest.so ct_test.cc
which gave no errors or warnings.
I then loaded ipython and typed the following:
import ctypes as ct
test=ct.CDLL("/home/paula/libs/libcttest.so")
if I now try to access the function (by typing 'test.' and then hitting tab) nothing happens.
If I do this:
What am I doing wrong?
Oh, just in case it makes any difference:
OS: xubuntu 14.10 Python: 2.7.8 ipython: 2.3.0 g++ : 4.9.1