Mixing MinGW with Open Watcom problem

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Mixing MinGW with Open Watcom problem

lollisoft
Hi,

I do still try to mix OW (1.7) and MinGW and fail. My current problem is passing three arguments to a member function.

What is working is passing three integers, but what is not working is passing a member callback that is defined as follows:

typedef lbErrCodes (LB_STDCALL ITest::*lbEvHandler)(lb_I_Unknown* uk);

enum lbErrCodes {
ERR_NONE = 0,
ERR_BLA,
ERR_LAST = 0x7fffffff // Force 32 Bit
};

#define LB_STDCALL __stdcall


class ITest {
    lbErrCodes LB_STDCALL Foo(int p1, int p2, int p3) = 0;

    // Don't worry about the callback functions in implementations of ITest. Real code is not doing this :-)
    lbErrCodes LB_STDCALL Register(ITest* instance, lbEvHandler handler, int number) = 0;
};

When I call the Foo I get correctly passed my values as I could printf them.
But calling Register(NULL, NULL, 12003); will print out that I have passed 0 or -1 regarding in what direction I call the function.

OW => MinGW Param is 0
versus
MinGW => OW Param is -1

OW => OW Param is 12003
versus
MinGW => MinGW Param is 12003

I have read about the structure alignment, but I think that this is not the problem here, as I have tested passing -mms-bitfields to g++.
Also I have tested using stack calling convention on the OW side, but I do not know how to correctly set this in g++.

I am using MinGW to enable using UnitTest, but I do not yet port all my code. That's why I like to mix compilers, but also because my code
was designed to be compiler mixable (COM like architecture).

Any help?

The assumption of stack versus register calling is my last try. If that will fail, I will stop mixing MinGW with OW.

Thanks

Lothar

-- | Rapid Prototyping | XSLT Codegeneration | http://www.lollisoft.de
Lothar Behrens
Heinrich-Scheufelen-Platz 2
73252 Lenningen












------------------------------------------------------------------------------

_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Reply | Threaded
Open this post in threaded view
|

Re: Mixing MinGW with Open Watcom problem

Earnie Boyd
Lothar wrote:
> Hi,
>
> I do still try to mix OW (1.7) and MinGW and fail. My current problem is passing three arguments to a member function.
>
> What is working is passing three integers, but what is not working is passing a member callback that is defined as follows:
>
> typedef lbErrCodes (LB_STDCALL ITest::*lbEvHandler)(lb_I_Unknown* uk);
>

You know already that mixing C++ ABI is just not doable for sane
operation.  Yet you continue to try.  There is a reason there is a FAQ
entry about MixingCompilers yet you seem to try to ignore it.

--
Earnie
-- http://www.for-my-kids.com

------------------------------------------------------------------------------

_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Reply | Threaded
Open this post in threaded view
|

Re: Mixing MinGW with Open Watcom problem

lollisoft

Am 16.05.2010 um 23:15 schrieb Earnie:

> Lothar wrote:
>> Hi,
>>
>> I do still try to mix OW (1.7) and MinGW and fail. My current problem is passing three arguments to a member function.
>>
>> What is working is passing three integers, but what is not working is passing a member callback that is defined as follows:
>>
>> typedef lbErrCodes (LB_STDCALL ITest::*lbEvHandler)(lb_I_Unknown* uk);
>>
>
> You know already that mixing C++ ABI is just not doable for sane
> operation.  Yet you continue to try.  There is a reason there is a FAQ
> entry about MixingCompilers yet you seem to try to ignore it.

I have read the FAQ or better the link about mixing compilers.

The main issue why I still try this is the knowledge, that COM works. But I may still not doing the stuff as COM will do.

I follow the rule to use extern "C" __cdecl for my functors that will create my objects.
I follow the rule not to malloc in one library and delete in another. Maybe I have small issues, but not yet detected.
I use pure abstract classes with no data members as one compiler will layout the data different than another.
I use __stdcall for all my member functions that are explicitly declared this way.

Now I assume some parameters will be placed into registers while the callee expect them on the stack.

But now I must agree, I keep believing it will work, but won't with moderate work, if it ever will work :-)

Simply it was a longer try :-)

And even COM will work, it may be due to the fact that most COM codebase will be compiled using Visual C++ I think.

It is now wise to completely port my code to MinGW or use a different Unit Test library that works with Open Watcom.
The unit testing stuff was the reason, why I tried this :-)

Regards

Lothar

>
> --
> Earnie
> -- http://www.for-my-kids.com
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> MinGW-users mailing list
> [hidden email]
>
> This list observes the Etiquette found at
> http://www.mingw.org/Mailing_Lists.
> We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.
>
> _______________________________________________
> You may change your MinGW Account Options or unsubscribe at:
> https://lists.sourceforge.net/lists/listinfo/mingw-users
>

-- | Rapid Prototyping | XSLT Codegeneration | http://www.lollisoft.de
Lothar Behrens
Heinrich-Scheufelen-Platz 2
73252 Lenningen












------------------------------------------------------------------------------

_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Reply | Threaded
Open this post in threaded view
|

Re: Mixing MinGW with Open Watcom problem

Earnie Boyd
Lothar wrote:
>
>
> It is now wise to completely port my code to MinGW or use a different Unit Test library that works with Open Watcom.
> The unit testing stuff was the reason, why I tried this :-)
>

Maybe the boost unit test library will help you.  AFAIK Boost can be
built by MinGW.

http://www.boost.org/doc/libs/1_34_0/libs/test/doc/index.html

--
Earnie
-- http://www.for-my-kids.com

------------------------------------------------------------------------------

_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Reply | Threaded
Open this post in threaded view
|

Re: Mixing MinGW with Open Watcom problem

lollisoft

Am 17.05.2010 um 15:18 schrieb Earnie:

> Lothar wrote:
>>
>>
>> It is now wise to completely port my code to MinGW or use a different Unit Test library that works with Open Watcom.
>> The unit testing stuff was the reason, why I tried this :-)
>>
>
> Maybe the boost unit test library will help you.  AFAIK Boost can be
> built by MinGW.
>
> http://www.boost.org/doc/libs/1_34_0/libs/test/doc/index.html
>

The problem is not MinGW, it is the Open Watcom compilet who is not capable of the more modern C++ features, but my code
relies on. But I'll take a look what the library requires. Maybe it also works with OW.

> --
> Earnie
> -- http://www.for-my-kids.com
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> MinGW-users mailing list
> [hidden email]
>
> This list observes the Etiquette found at
> http://www.mingw.org/Mailing_Lists.
> We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.
>
> _______________________________________________
> You may change your MinGW Account Options or unsubscribe at:
> https://lists.sourceforge.net/lists/listinfo/mingw-users
>

-- | Rapid Prototyping | XSLT Codegeneration | http://www.lollisoft.de
Lothar Behrens
Heinrich-Scheufelen-Platz 2
73252 Lenningen












------------------------------------------------------------------------------

_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Reply | Threaded
Open this post in threaded view
|

Re: Mixing MinGW with Open Watcom problem

Earnie Boyd
Lothar wrote:

>
> Am 17.05.2010 um 15:18 schrieb Earnie:
>
>> Lothar wrote:
>>>
>>>
>>> It is now wise to completely port my code to MinGW or use a different Unit Test library that works with Open Watcom.
>>> The unit testing stuff was the reason, why I tried this :-)
>>>
>>
>> Maybe the boost unit test library will help you.  AFAIK Boost can be
>> built by MinGW.
>>
>> http://www.boost.org/doc/libs/1_34_0/libs/test/doc/index.html
>>
>
> The problem is not MinGW, it is the Open Watcom compilet who is not capable of the more modern C++ features, but my code
> relies on. But I'll take a look what the library requires. Maybe it also works with OW.
>

You will not find help here with Open Watcom.  Nor will you find any
help in trying to mix compiler sets for C++ because it is futile.  Why
can't you just use MinGW or Open Watcom as a whole rather than mixing in
pieces from each other?

--
Earnie
-- http://www.for-my-kids.com

------------------------------------------------------------------------------

_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users