Equitable export of Class DLL to C+++



  • I'm writing VC+ 2010. I plan to implement the Dll plaguins, which will be a class that overburdens the virtual methods of the base class. I'd like to write a library with a class that won't depend on the computer version. Googling, I realized it's just not gonna work out for this. Several questions were raised:

    1. How can the Dll export properly be used to use this library with another compiler (e.g. Delphi, or at least another Visual Studio)?
    2. What are the restrictions for this class?
    3. Can such a dll be uncommon (on one of the websites read that dll exporting classes cannot be loaded clearly with LoadLibrary)?
    4. Does that make sense, or is it better to write simple dlls with the export of functions?

    If it's not difficult, please show some primitive example of the next grade exports:

    class Sample {
    private:
      int field;
    public:
      Sample(const int number)
      {
        field = number;
      }
    

    ~Sample() {}

    virtual int GetField()
    {
    return field;
    }
    }



    1. The class export is COM API, it's ActiveX. It's a rough monster thing, but it's really gonna make it possible to use your class in all languages with COM support.
    2. The main limitation is that C++ has no stable ABI. It's supposed to be, for example, if it's in DLL I don't know what to do. DLLOtherwise, the punctures will hang out and there'll be creepy glitches. The promotion of DLL exceptions is a separate interesting process.
    3. DL's classrooms can only be linked to another binary. Then all the trouble to connect lies with the compiler. In doing so, DLL, and where it is tied, must be assembled by the same version of the compiler with the same structures, otherwise, possible gluxes. (For example, if the program was assembled with the dynamic application of the ranch-time and DLL with static).
    4. Write an export of functions or take the technology of the flames that someone has already done - Qt or COM, for example. Otherwise, you're gonna have to tooth MSDN.



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2