I have developed a C++ class to access the software protection dongle on USB. The C++ class has been developed with g++ under Linux, but I can compile it successfully using MinGW under Windows. I have a scientific application which is built with VB6 (Visual Basic 6).

The question is how can I expose my C++ class to a VB6 app? What are the possible ways to do it? Do I need to use COM? (Well, a "Microsoft-less" solution is more preferable:)

Your help is much appreciated!

Update 1. Reading your comments I realized I need to implement a COM wrapper to the C++ class. Are there any good and recent examples around? Can I implement the COM wrapper using MinGW (and avoiding MSVC)?

Update 2. Finally, I decided to offer a bounty for this question. Below are the things I would like to understand better:

1. I realized I need to implement a COM wrapper to my C++ class. Can someone please provide me with working example on how to make this for a class like this:

class ValueMapper
{
public:
    ValueMapper( ) { }

    ValueMapper( double fmin, double fmax, int ilength ) {
        SetMapping( fmin, fmax, ilength );
    }

    inline double GetMin() { return min; }
    inline double GetMax() { return max; }
    inline int GetLength() { return length; }

    virtual inline void SetMapping( double fmin, double fmax, int ilength )
    {
        min = fmin;
        max = fmax;
        length = ilength;
    }

    virtual inline int MapValue( double value ) {
        double factor = length / (max - min);
        return (int)RoundTo( (value-min) * factor );
    }

    static double RoundTo( double value, double eps = 1 ) {
        return floor(value/eps + 0.5) * eps;
    }

protected:
    double  min;
    double  max;
    int     length;
};

2. How to use the resulting COM wrapper from the VB6? Do I need to register a COM server or so? Can I use it

Edit
Report