From: <ma...@go...> - 2007-03-23 01:06:33
|
> Lets say i have a header file that contains: > > class csLibraryReference : > public scfImplementationExt2<csLibraryReference, > csObject, > iLibraryReference, > iSelfDestruct> > { > csString file; > csString path; > bool checkDupes; > > public: > /// The constructor. > csLibraryReference (const char* file, const char* path > = 0, bool checkDupes = false); > /// The destructor > virtual ~csLibraryReference (); > virtual const char* GetFile () const; > virtual const char* GetPath () const; > virtual bool GetCheckDupes () const; > virtual iObject *QueryObject () { return > (csObject*)this; } > void SelfDestruct () {} > }; > > > I will get a warning such as > > > /development/cs/include/cstool/saverref.h(0): > Warning(401): Nothing known about base class > 'scfImplementationExt2<csLibraryReference, csObject, > iLibraryReference,iSelfDestruct>'. Ignored. > /development/cs/include/cstool/saverref.h(0): > Warning(401): Maybe you forgot to instantiate > 'scfImplementationExt2<csLibraryReference, csObject, > iLibraryReference,iSelfDestruct>' using %template. > > > So say the next thing I'll do is insert above the class > declaration so the waring goes away. > > #ifdef SWIG > > %template() scfImplementationExt2<csLibraryReference, > csObject, iLibraryReference,iSelfDestruct>; > > #endif > > so this means its ready and all the required info for > construction as well for %template(). > > I have serveral hundred of these todo.. can I make SWIG do > this for me automatically? > > > > Thank you, > Douglas > Hello Douglas, A neater solution is to add this stuff into the .i file. That way you don't mess up the original headers (which is always a good idea). ===cspace.i==== %template() scfImplementationExt2<csLibraryReference,csObject, iLibraryReference,iSelfDestruct>; %include "saverref.h" .... ================ The other thing you can do is to carefully include the various files in certain order. Like in C/C++, the order that you include makes a difference. If you don't want to include a certain file, you can just add a few declarations and stuff into the .i file to help in the parsing. It looks like you are trying to wrapper crystal space 3d. There were a previous set of SWIG wrappers written for it. Do they no longer work? I seem to remeber that those wrappers made heavy use of macro's, you might be able to do the same. Regards, Mark |