[Matrix-SIG] Modules: Shared Lib
Patrick Dahiroc
patd@wam.umd.edu
Tue, 17 Aug 1999 09:41:30 -0400 (EDT)
hi all
i'm having problems making a shared object for a python extension module
that i wrote. below is the steps i took to make the module. (i just
followed the steps in the GCC-HOWTO)
gcc -fPIC -Imyinc -Lmylib -c maptrans.c
gcc -shared -Wl,-soname,maptrans.so.1 -o maptrans.so.1.0 maptrans.o
ln -s maptrans.so.1.0 maptrans.so.1
ln -s maptrans.so.1 maptrans.so
maptrans.c wraps a map transformation routine in one of my library.
when i run python and 'import maptrans', i get an error that says
something like ' undefined init function (initmaptrans) '. but in
maptrans.c i do have the function
static PyObject *wrap_mapconvert(self, args){
char *blah, *BLAH;
PyArg_ParseTuple(args, "ss", &blah, &BLAH)
MAPCONV(BLAH,blah);
/* MAPCONV - function from mylib/libMAP.a */
return PyBuildValue("s",blah);
}
static PyMethodDef maptrans_method[] = {
{"mapconvert", wrap_mapconvert,METH_VARARGS},
{NULL,NUL}};
void initmaptrans(){
Py_InitModule("maptrans",maptrans_method)}
i have never made a shared library nor extended python before. any help
you could suggest is much appreciated.
TYA
pd