Page 1 of 3

First tests with MinGW (gcc for Windows)

PostPosted: Wed Sep 17, 2008 8:25 pm
by Antonio Linares
We have started testing MinGW (GNU C compiler ported to Windows) and we have to say that the first tests are very promising :-)

You can download and install MinGW from here:
http://sourceforge.net/project/showfile ... _id=595197
Select the EXE setup.

Once installed on your computer, go to c:\MinGW\bin\

Create a file test.c with these contents:
test.c
Code: Select all  Expand view
#include <windows.h>

int WINAPI WinMain( HINSTANCE hInstance,   HINSTANCE hPrevInstance, LPSTR lpCmdLine,   int nCmdShow )
{
   MessageBox( 0, "Hello World", "From MingW", MB_ICONINFORMATION );
   
   return 0;
}

To build it, simply do:
gcc -otest.exe -mwindows test.c

Then you get test.exe, which it is a very small and self contained EXE. You can download the test.c file and the test.exe from here:
http://rapidshare.com/files/146133212/test.zip.html

PostPosted: Wed Sep 17, 2008 8:49 pm
by Antonio Linares
The make (EXE) file that we need to build Harbour and xHarbour can be downloaded from here:

http://sourceforge.net/project/showfile ... e_id=23918

PostPosted: Wed Sep 17, 2008 10:02 pm
by Antonio Linares
Building Harbour with MinGW:

Well, it worked ok on first try :-)

I created a makegnu.bat file with these contents:
Code: Select all  Expand view
set PATH=c:\MinGW\bin;%PATH%
echo mingw32-make.exe > make.bat
make_gnu.bat
del make.bat


Harbour.exe and libraries have been properly created. Next step, create a
EXE with Harbour and using its libraries :-)

PostPosted: Wed Sep 17, 2008 10:20 pm
by Antonio Linares
A first EXE built with Harbour and MinGW has been a success :-)

I created a simple test.prg and a batch file to build it:
test.prg
Code: Select all  Expand view
function Main()

  Alert( "Hello world!" )

return nil

go.bat
Code: Select all  Expand view
c:\harbour\harbour\source\main\w32\mingw32\harbour.exe test.prg /n

c:\mingw\bin\gcc -c -otest.o -Ic:\harbour\harbour\include test.c

c:\mingw\bin\gcc test.o -otest.exe -Lc:\harbour\harbour\lib\w32\mingw32 -Wl,--start-group -lhbcommon -lhbvm -lhbrtl -lhbrdd -lhbmacro -lhblang -lhbcpage -lhbpp -lrddntx -lrddcdx -lrddfpt -lhbsix -lhbusrrdd -lhbct -lgtwin -lhbdebug -Wl,--end-group


Quite simple and here we have the result :-)
Image
Here you have the PRG, .bat and .EXE files:
http://rapidshare.com/files/146158123/test.zip.html

Next stage, to recompile FWH using MinGW...

PostPosted: Wed Sep 17, 2008 11:24 pm
by driessen
Antonio,

Can you explain a little bit ?

What is MinGW and what can it mean to us in our FiveWin world ?

Thanks.

PostPosted: Wed Sep 17, 2008 11:57 pm
by Antonio Linares
Michel,

We are looking for a modern C compiler to build our EXEs with FWH and Harbour/xHarbour.

Borland C 5.5 is from year 2000. More recent Borland C compiler versions are difficult to locate as are distributed as part of C++ Builder (huge) demo versions, that can't be redistributed because licence restrictions, etc.

Microsoft forces us to install lots and lots of tools that we don't need and they are constantly changing them, and pushing towards .NET (a technology that they don't use themselves!).

Thats why we are start reviewing gcc (GNU C compiler) for Windows (named MinGW). As it is simple, modern and supported by lots of users. And it is free and open source.

The same way we migrated from Clipper to Harbour, now we have to start considering to migrate from Borland C 5.5 to an open source and modern C compiler.

PostPosted: Thu Sep 18, 2008 12:19 am
by James Bott
Antonio,

This is an exciting development! I look forward to more news.

Regards,
James

PostPosted: Thu Sep 18, 2008 3:05 am
by mmercado
Antonio Linares wrote:We are looking for a modern C compiler to build our EXEs with FWH and Harbour/xHarbour.
Hi Antonio:

Does MinGW require a (x)Harbour's special build?

Regards.

Manuel Mercado

PostPosted: Thu Sep 18, 2008 6:44 am
by Antonio Linares
Manuel,

We have not tested it yet, but all you have to do is build it using the xHarbour's provided make_gnu.bat, from the CVS files.

PostPosted: Thu Sep 18, 2008 7:06 am
by driessen
Antonio,

Thanks for your clear explanation.

How about using this C-compiler together with xHarbour Builder ?

Or do I have to ask this question to Patrick and his team ?

Thanks.

PostPosted: Thu Sep 18, 2008 7:21 am
by Antonio Linares
Michel,

You can not mix MinGW OBJ files with PellesC (the one used by xHB) OBJ files.

Our idea is to provide a FWH built with MinGW for those that want to use this open source compiler (used in Windows, Windows Mobile, Linux, Mac and iPhone).

But we will keep distributing the FWH built with Borland and Microsoft too, for those that want to keep using them.

PostPosted: Thu Sep 18, 2008 8:51 am
by Antonio Linares
I have to admit that I am quite impressed with MinGW gcc quality :-)

It is reporting warnings that Borland neither Microsoft were not detecting.

the FWH version compiled with MinGW is almost ready :-)

PostPosted: Thu Sep 18, 2008 11:47 am
by Antonio Linares
We already have a first release of FWH built with MinGW :-)

And it is working really fine!

It is going to be provided as a beta to the users of the just published FWH 8.09 :-)

PostPosted: Thu Sep 18, 2008 7:25 pm
by Roberto Parisi
What about performances against BCC55 on harbour executables built with it?

PostPosted: Thu Sep 18, 2008 7:29 pm
by Antonio Linares
Roberto,

Its soon to talk about performance. As soon as betatesters use it, we will know their impressions and results.

But when we use MinGW to build Harbour here, it gets built real fast :-)

Faster than using Microsoft or Borland.