I am writing a program in python. now i want to use ctypes to use some functions of a class i have in c++. so basically , i have an array of data in python. i have another program in c++ which is supposed to use that array and transform it to an image class. here is the program i have in c++. i have already made the makefile in linux and it compiles.
the name of the file is 'pclink.cpp'
#include <stdio.h>
#include "MImage.h"
#include<stdlib.h>
#ifdef __cplusplus
extern "C" {
#endif
int conv(double* data, int x,int y, int z, int len) {
MImage M;
//M.MLoadFromArray(data,x,y,z,len);
return 0;
}
#ifdef __cplusplus
}
#endif
I have also made the .so and .o files every thing seems fine. but when in python i type
import numpy as np
import ctypes
import os
pclink = np.ctypeslib.load_library('pclink','.')
this is the message i get
Traceback (most recent call last):
File "<pyshell#10>", line 1, in <module>
pclink=np.ctypeslib.load_library('pclink','.')
File "/usr/lib/python2.7/dist-packages/numpy/ctypeslib.py", line 131, in load_library
raise exc
OSError: /home/lucy94/pclink.so: undefined symbol: _ZN6MImage14MLoadFromArrayEPdiiii
previously i tried to link c++ and python with a simple program which does not have any classes and it works fine. it seems the problem is when i try to define an object from another class. so any one knows how to fix the problem? thanks