title: Exporting methods of nested classes from dll
body: <p>I have *.cpp and *.hpp files with class having the following structure:</p>
  <h2>first hpp file</h2>
  <pre><code>class FirstClass{
  public:
      FirstClass();
      ~FirstClass();
  
      SHORT FirstMethod(arguments ...);
      void  SecondMethod(arguments ...);
      ULONG thirdMethod(arguments ...);
      ....
      void lastMethod();
  private:
      std::list&lt;std::string&gt; STLStringList;
  };
  </code></pre>
  <p>I try to export my main class from DLL and use functions from my nested class (class FirstClass). I create main class having the following structure:</p>
  <h1>main class</h1>
  <pre><code>#ifdef MAINCLASSDLL_EXPORTS
  #define MAINCLASS_API __declspec(dllexport)
  #else
  #define MAINCLASS_API __declspec(dllimport)
  #endif
  
  // This class is exported from the MainClassDll.dll
  class MAINCLASS_API MainClassDll{
  public:
      MainClassDll();
      // Methods from class FirstClass
      virtual SHORT FirstMethod(arguments ...);
      virtual void  SecondMethod(arguments ...);
      virtual ULONG thirdMethod(arguments ...);
      ....
      virtual void lastMethod();
  };
  
  
  extern &quot;C&quot;{
      MAINCLASSDLL_API MainClassDll *CreateObject();
      MAINCLASSDLL_API void DestroyObject(MainClassDll *pobjMainClassDll );
  }
  </code></pre>
  <p>Methods form FirstClass use private STLStringList and all methods must use the same object of FisrtClass. I try to create method which export pointer to object of FirstClass but when I try to use this methods my program crashes. I can't change struct of FirstClass.
  It is possibly to create DLL project to used methods from my nested class without interfering with nested class??</p>