-----Original Message----- From: Sells, Fred Sent: Tuesday, August 16, 2005 5:09 PM To: python-list@python.org Subject: python oldie, SWIG newbie needs help
I've been trying all day to get a simple SWIG generated interface to a simple (but ugly) piece of c++ code provided to us by the gov't. I've tried google, and every variation on the examples I can think of. I'm really under the gun to get this working and would appreciate someone showing me the error of my ways. We're running python 2.3 redhat 9 and gcc although the code is c++, it does not use classes and the only function I need to access is "RugCacl". My typical error messages are shown below and the files attached. I've tried SWIG with and without --shadow. If my last line of the .i file is %include rug520.cpp, I don't get an error on import, but the RugCalc function is undefined. $ python rug520.py Traceback (most recent call last): File "rug520.py", line 5, in ? import _rug520 ImportError: /home/frsells/dll/_rug520.so: undefined symbol: RugCalc part of the c++ code is below; the whole file was bigger than the mail handler would accept. #include "rug520.h" #include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #define LINUX char masItemVal[108][5]; void LoadValue( char * sMdsRecord, int location, int length, char * masItemValue ) { for ( int i=0; i<length; i++ ) masItemValue[i] = sMdsRecord[location+i]; masItemValue[length] = '\0'; } int LoadRange() ..... #ifdef LINUX int RugCalc( char * sMdsRecord, char * sRehabType, char * sModel, int iQuarterlyFlag, double nCmiArray[], char * sRugHier, char * sRugMax, int * iRugHier, int * iRugMax, double * nCmiValueHier, double * nCmiValueMax, int * iAdlSum, int * iCpsCode, char * sRugsVersion, char * sDllVersion, int * iError ) #else extern "C" __declspec(dllexport) int __stdcall RugCalc( char * sMdsRecord, char * sRehabType, char * sModel, int iQuarterlyFlag, double nCmiArray[], char * sRugHier, char * sRugMax, int * iRugHier, int * iRugMax, double * nCmiValueHier, double * nCmiValueMax, int * iAdlSum, int * iCpsCode, char * sRugsVersion, char * sDllVersion, int * iError ) #endif --------------------------------------------------------------------------- The information contained in this message may be privileged and / or confidential and protected from disclosure. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by replying to this message and deleting the material from any computer. ---------------------------------------------------------------------------
build.sh
Description: Binary data
rug520.h
Description: Binary data
rug520.i
Description: Binary data
-- http://mail.python.org/mailman/listinfo/python-list