Page 1 of 2

HMG 64 Bit C-Syntax

Posted: Tue Sep 29, 2020 9:27 am
by AUGE_OHR
hi,

i add a some new Code to HB_FUNC.PRG and it remember me of 64 Bit Version Warnings

Code: Select all

    HDROP hDrop  = ( HDROP ) hb_parnl( 1 );
HB_FUNC.PRG:116:19: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
or

Code: Select all

   HDROP hDrop  = hb_parnl( 1 ) ;
HB_FUNC.PRG:116:19: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
it will run and seems not to make Problems ...

but i like to learn how to get rid of those Warnings with C-Code under HMG 64 Bit
who can help me with this Code please
HB_FUNC_x64.ZIP
(3.81 KiB) Downloaded 223 times

Re: HMG 64 Bit C-Syntax

Posted: Tue Sep 29, 2020 11:01 am
by esgici
My master would say:

"Don't play "core" of tools !

instead concentrate yourself to better understanding their usage;

and if you need, prepare your tool by yourself"

hope nobody gets me wrong

Happy HMG'ing

Re: HMG 64 Bit C-Syntax

Posted: Tue Sep 29, 2020 2:32 pm
by KDJ
Jimmy

Try this:

Code: Select all

#if defined _WIN64
  HDROP hDrop = (HDROP) hb_parnll(1);
#else
  HDROP hDrop = (HDROP) hb_parnl(1);
#endif

Re: HMG 64 Bit C-Syntax

Posted: Tue Sep 29, 2020 3:21 pm
by srvet_claudio
Hi,
see hmg doc:
HMG_parnl(n);
HMG_retnl(n);

Re: HMG 64 Bit C-Syntax

Posted: Tue Sep 29, 2020 10:18 pm
by AUGE_OHR
hi.
KDJ wrote: Tue Sep 29, 2020 2:32 pm Jimmy

Try this:
YES ... this work, THX

now i have

Code: Select all

#if defined _WIN64
   #define GETHWND ( HWND ) hb_parnll( 1 )
   #define GETHDROP (HDROP) hb_parnll( 1 )
   #define GETHICO  (LONGLONG ) hb_parnll( 1 )
   #define GETHBHDR (PDEV_BROADCAST_HDR) hb_parnll( 2 )
#else
   #define GETHWND ( HWND ) hb_parnl( 1 )
   #define GETHDROP (HDROP) hb_parnl( 1 )
   #define GETHICO  ( LONG ) hb_parnl( 1 )
   #define GETHBHDR (PDEV_BROADCAST_HDR) hb_parnl( 2 )
#endif
seem to compile/link without Warnings :D

i´m not a C-Programmer. i can only "speak" xBase so sorry for my Newbie Question.

Re: HMG 64 Bit C-Syntax

Posted: Tue Sep 29, 2020 10:32 pm
by srvet_claudio
AUGE_OHR wrote: Tue Sep 29, 2020 10:18 pm hi.
KDJ wrote: Tue Sep 29, 2020 2:32 pm Jimmy

Try this:
YES ... this work, THX

now i have

Code: Select all

#if defined _WIN64
   #define GETHWND ( HWND ) hb_parnll( 1 )
   #define GETHDROP (HDROP) hb_parnll( 1 )
   #define GETHICO  (LONGLONG ) hb_parnll( 1 )
   #define GETHBHDR (PDEV_BROADCAST_HDR) hb_parnll( 2 )
#else
   #define GETHWND ( HWND ) hb_parnl( 1 )
   #define GETHDROP (HDROP) hb_parnl( 1 )
   #define GETHICO  ( LONG ) hb_parnl( 1 )
   #define GETHBHDR (PDEV_BROADCAST_HDR) hb_parnl( 2 )
#endif
seem to compile/link without Warnings :D

i´m not a C-Programmer. i can only "speak" xBase so sorry for my Newbie Question.
Without wanting to offend you, but you are reinventing the wheel! Read the HMG 64 bit documentation.

Re: HMG 64 Bit C-Syntax

Posted: Wed Sep 30, 2020 12:32 am
by AUGE_OHR
hi,
srvet_claudio wrote: Tue Sep 29, 2020 10:32 pm Without wanting to offend you, but you are reinventing the wheel! Read the HMG 64 bit documentation.
THX for Hint
i have read about HMG 64-bits Documentation but i´m still Newbie on 64 Bit.
i´m not a C-Programmer only Xbase++ and Ot4xb which give me Access to Windows Structure and API Function

---

when got Error :o
hbmk/win/mingw/FMGRID.o:FMGRID.c:(.data+0x1168): undefined reference to `HB_FUN_DESTROYICON'
i wonder why i get the Error while it is used in
c:\hmg.3.4.4\SOURCE\c_controlmisc.c
c:\hmg.3.4.4\SOURCE\c_status.c
in Extended Version i found c:\MiniGUI\SOURCE\c_icon.c

Code: Select all

// BOOL WINAPI DestroyIcon( HICON hIcon )
HB_FUNC( DESTROYICON )
{
   hb_retl( DestroyIcon( ( HICON ) ( LONG_PTR ) HB_PARNL( 1 ) ) );
}
now i try to modify that Code to

Code: Select all

   hb_retl( DestroyIcon( ( HICON ) ( LONG_PTR ) HMG_parnl( 1 )  ) );
and got
HB_FUNC.PRG: In function 'HB_FUN_DESTROYICON':
HB_FUNC.PRG:407:49: warning: implicit declaration of function 'HMG_parnl' [-Wimplicit-function-declaration]
hbmk2: Linking... HBFM.exe
.hbmk/win/mingw/HB_FUNC.o:HB_FUNC.c:(.text+0xf9b): undefined reference to `HMG_parnl'
so i´m still stuck "how" to use HMG_* instead of hb_* :cry:

i still have to learn lot.
thx for help

Re: HMG 64 Bit C-Syntax

Posted: Wed Sep 30, 2020 12:47 am
by srvet_claudio
Hi,
see doc:
HMG defines a series of macros (INCLUDE\HMG_UNICODE.h) that take a value of 32 or 64 bit according to the architecture chosen for compiling:
#include "HMG_UNICODE.h"

Re: HMG 64 Bit C-Syntax

Posted: Wed Sep 30, 2020 1:10 am
by AUGE_OHR
hi,
srvet_claudio wrote: Wed Sep 30, 2020 12:47 am #include "HMG_UNICODE.h"
Thx
i did it and got
c:\hmg.3.4.4\include\HMG_UNICODE.h(99) Error F0029 Can't open #include file 'tchar.h'
hbmk2[HBFM]: Error: Running Harbour compiler (embedded). 1
:(

Re: HMG 64 Bit C-Syntax

Posted: Wed Sep 30, 2020 1:27 am
by srvet_claudio
Put the include into c code.