On Thu, 15 May 2008, Chen Kedem wrote:

Hi Chen,

> Using ChangeLog 2008-05-15 03:40 UTC+0100 Viktor Szakats and Win32/BCC
> ---tt12.prg---
> REQUEST HB_GT_WIN
> REQUEST HB_GT_STD
> REQUEST HB_GT_WVT
> proc test()
> ?
> return
> --------------
> make_b32 tt12 /w/a/n
> tt12           --> Ok
> tt12 //gt:std  --> Ok
> tt12 //gt:win  --> Ok
> tt12 //gt:wvt  --> 425 errors from CodeGuard
> Error 00001. 0x300010 (Thread 0x00A3):
> Resource leak: The memory block (0xCBA2C4) was never freed
> The memory block (0x00CBA2C4) [size: 116 bytes] was allocated with malloc
> Call Tree:
>    0x0041AD3B(=tt12.exe:0x01:019D3B) source\vm\FM.C#245
>    0x004153BE(=tt12.exe:0x01:0143BE) source\vm\ESTACK.C#224
>    0x00420538(=tt12.exe:0x01:01F538) source\vm\HVM.C#390
>    0x0044BC29(=tt12.exe:0x01:04AC29) source\vm\MAINSTD.C#66
>    0x004E974A(=tt12.exe:0x01:0E874A)

I can only guess that it's caused by exiting application
from internal error handler. When internal error handler
is executed we do not release any allocated resources so
you will always have such report. You can ignore it.

[...]
> The memory block (0x00CB8290) [size: 116 bytes] was allocated with malloc
> Call Tree:
>    0x0041AD3B(=tt12.exe:0x01:019D3B) source\vm\FM.C#245
>    0x004153BE(=tt12.exe:0x01:0143BE) source\vm\ESTACK.C#224
>    0x00420538(=tt12.exe:0x01:01F538) source\vm\HVM.C#390
>    0x0044BC29(=tt12.exe:0x01:04AC29) source\vm\MAINSTD.C#66
>    0x004E974A(=tt12.exe:0x01:0E874A)
> and there are 240 more...
> Maybe I need to use source\vm\MAINWIN.C instead of MAINSTD.C when
> using that GT?

Yes, you must use WinMain() start entry for Windows GUI applications.
GTWVT and GTWVG are GUI GTs. If you do not link your program as GUI
one then you have:
   hb_errInternal( 10001, "It's not a window GUI program.", "", "" );
at application startup and CodeGuard reports above memory leaks.

> if so, how do I do that?

It depends on used C compiler / linker. If you are using BCC then
it has special switch to create GUI programs with WinMain() startup
entry. AFAIR it was -tW. You can use programs linked in such way
also with other GTs but please remember that they are automatically
detached from current console, f.e. try GTWIN.
In other compiler you will have different switches.
MinGW tries to guess automatically requst mode during linking by
scaning existing symbol table. If it finds main() function then
it creates console program. Otherwise GUI one starting with WinMain().
It's the reason why I excluded mainstd.c from HVM library and moved
it to separate library mainstd (see source/vm/Makefile) so user can
control type of application by adding this library to linked library
list.
In *nixes such problem does not exists and you can use the same binaries
for GUI and CUI mode.

HTH,

best regards,
Przemek
_______________________________________________
Harbour mailing list
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to