Jump to content

Chojun

Members
  • Content Count

    2
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Chojun

  • Rank
    Newbrie
  1. Hello, My software project uses interfaces extensively because we have a fair range of hardware and configurations that we're supporting. Using interfaces cleans up our code and design considerably. The most critical piece, an event engine, uses interfaces as well. However, I'm having all kinds of problems with using interfaces in sourceboost. Firstly, I'd like to point out that if you define an interface, and have a class that implements the interface but forgets to implement one of the interface methods, the compiler (or linker, can't remember which) will crash. The compiler should really catch this. Would've saved me hours of troubleshooting if it had. .. Second, I've come to suspect the way that SourceBoost constructs the vTable since a piece of code that should work absolutely will not. Take the following code example (please ignore syntax/semantics as I'm typing this up on the fly, but if anything stands out feel free to ask): class IInterface { public: virtual void foo() = 0; } class A : public IInterface { public: void foo() { ... } } class B : public IInterface { public: void foo() { ... } } class CFactory { public: void run() { IInterface *array[3]; A a; B b; array[0] = &a; array[1] = &b; array[2] = 0; processClasses(array); } void processClasses(IInterface **array) { int i = 0; while (array[i] != 0) array[i++]->foo(); //!!! Locks up here !!! } } With the program locking up on the call to the interface method, it causes me to wonder if something is wrong with sourceboost's vTable implementation. If I were to do something like this instead: (A *)array[0]->foo(); ..then it works great, but defeats the purpose of interfaces and throws our whole design out the window. Anyone have any insight into the problem I'm experiencing? Thank you very much in advance!
  2. Hello, I'm currently involved in a project that is cross-platform with PIC microcontrollers and Windows PC machines. The PIC and Win32 code share a common codebase with common interfaces, but the implementations are platform-specific. In visual studio I'm able to do something like #if defined(WIN32) in a master compile config header file so that it will only compile win32 stuff and ignore the PIC stuff, and this works very well in Visual Studio/Win32. My question is, does SourceBoost have similar Environment Variables defined by the IDE that I could use to detect that I'm compiling using SourceBoost or BoostC++, etc (and ergo automatically ignore Win32/64 stuff when compiling in SourceBoost)? Thank you very much! Chojun
×