I have started converting my c library to c++ to make use of STL.
class Laff { private: bool case_sensitive; public: Laff(); ~Laff(void);
std::string path; cdmg_ht* cells; // cdmg_ht* layer_info; HashTable<std::string,LaffLayer*> layer_info;
char* Path(std::string ipath="");
bool Add(std::string file,bool replace=false,bool hier=false,std::string rep_cell="");
bool AddCell(std::string new_cell="");
bool AddCellPointer(cell_t* new_cell=NULL);
char* CellNameIterator(bool flag=false);
void ResetLayerInfo(void);
void BuildLayerInfo(void);
bool Free(void);
};
class laff_db : public Laff { };
Previously the laff_db was a typedef struct laff_db { char* path; cdmg_ht *cells; cdmg_ht * layer_info; }
Doing the above lets me take baby steps in converting calls and functions from. Laff * db. LaffSomething(db) db->Something();
Very good for slow conversion and testing of 17k lines of code. More before I switch to STL (string, lists, hash's)
Now the problems comes from the perl XS:
Here's my typemap : Laff T_PTROBJ Laff::Node T_PTROBJ Laff::Cell T_PTROBJ
Here's the top of my xs: #ifdef __cplusplus extern "C" { #endif #include <stdio.h> #include "EXTERN.h" #include "perl.h" #include "XSUB.h" #ifdef __cplusplus } #endif
#include "Ui.h" #include "ExCommand.h" #include "my_string.h" #include "Laff.h" #include "xyArray.h" using namespace std;
typedef node_t * Laff__Node; typedef cell_t * Laff__Cell; typedef laff_db * Laff;
MODULE = Laff PACKAGE = Laff PREFIX=Laff
PROTOTYPES: DISABLE
int Laff_DESTROY(db) Laff db CODE: RETVAL = LaffFree(db); OUTPUT: RETVAL
I get the following error message at compile time:
Laff.c: In function `void XS_Laff__DESTROY(PerlInterpreter*, CV*)':
Laff.c:76: error: no matching function for call to `Laff::Laff(IV&)'
/data/cdmg/dev/cdmg_toolbox/Laff/Laff.h:453: note: candidates are: Laff::Laff(const Laff&)
/data/cdmg/dev/cdmg_toolbox/Laff/Laff.h:457: note: Laff::Laff()
Laff.xs:133: error: cannot convert `Laff' to `laff_db*' for argument `1' to `int LaffFree(laff_db*)'
It seems the clash of names between my c++ class Laff and the perl-xs class Laff are in comflict. How can I resolve this?
___ _ ____ ___ __ __
/ _ )(_) / /_ __ / _ \___ _/ /_/ /____ ___
/ _ / / / / // / / ___/ _ `/ __/ __/ _ \/ _ \
/____/_/_/_/\_, / /_/ \_,_/\__/\__/\___/_//_/
/___/ Texas Instruments ASIC Circuit Design Methodology Group
Dallas, Texas, 214-480-4455, [EMAIL PROTECTED]