From: Winkelman, J. <Jef...@sc...> - 2006-02-28 18:05:02
|
Hello, I am using SWIG to expose a large 3rd party C++ library that we use to Python. The library exposes a couple global classes, for example: extern Foo foo; The Foo class is defined in a header file. The problem I am having is that the user is supposed to only use the global instance, foo. I never have to create an actual instance of the Foo. While the header file defines a constructor and destructor for the Foo class, the supplied lib / DLL does not implement them. Therefore, when I try to wrap the Foo class, I have linker issues (unresolved symbols). I attempted to comment out the declared constructor / destructor and implement my own with the extend feature. This doesn't work either, the compiler complains stating that new_Foo must return a value. Does anyone have a suggestion on how I can expose the interface for the Foo class to Python so that it can access the global Foo instance? Thanks for your help in advance, Jeff - - - - - - - Appended by Scientific-Atlanta, Inc. - - - - - - - This e-mail and any attachments may contain information which is confidential, proprietary, privileged or otherwise protected by law. The information is solely intended for the named addressee (or a person responsible for delivering it to the addressee). If you are not the intended recipient of this message, you are not authorized to read, print, retain, copy or disseminate this message or any part of it. If you have received this e-mail in error, please notify the sender immediately by return e-mail and delete it from your computer. |
From: Marcelo M. <mm...@ac...> - 2006-02-28 18:35:45
|
either try putting in your interface file: %nodefault Foo; to avoid the generation of the default constructor/destructors, or define it as class Foo { public: <public methods> private: Foo() {} ~Foo() {} }; Marcelo Winkelman, Jeff wrote: > Hello, > > I am using SWIG to expose a large 3rd party C++ library that we use to=20 > Python. > > The library exposes a couple global classes, for example: > > extern Foo foo; > > The Foo class is defined in a header file. > > The problem I am having is that the user is supposed to only use the=20 > global instance, foo. > > > I never have to create an actual instance of the Foo. > > While the header file defines a constructor and destructor for the Foo=20 > class, the supplied lib / DLL does not implement them. > > Therefore, when I try to wrap the Foo class, I have linker issues=20 > (unresolved symbols). > > > I attempted to comment out the declared constructor / destructor and=20 > implement my own with the extend feature. > > This doesn=92t work either, the compiler complains stating that new_Foo= =20 > must return a value. > > Does anyone have a suggestion on how I can expose the interface for=20 > the Foo class to Python so that it can access the global Foo instance? > > Thanks for your help in advance, > > Jeff > > > > - - - - - - - Appended by Scientific-Atlanta, Inc. - - - - - - - > This e-mail and any attachments may contain information which is=20 > confidential, proprietary, privileged or otherwise protected by law.=20 > The information is solely intended for the named addressee (or a=20 > person responsible for delivering it to the addressee). If you are not=20 > the intended recipient of this message, you are not authorized to=20 > read, print, retain, copy or disseminate this message or any part of=20 > it. If you have received this e-mail in error, please notify the=20 > sender immediately by return e-mail and delete it from your computer. |