HMG 64 Bit C-Syntax

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

User avatar
AUGE_OHR
Posts: 2093
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

HMG 64 Bit C-Syntax

Post 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 222 times
have fun
Jimmy
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: HMG 64 Bit C-Syntax

Post 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
Viva INTERNATIONAL HMG :D
KDJ
Posts: 243
Joined: Mon Sep 05, 2016 3:04 am
Location: Poland

Re: HMG 64 Bit C-Syntax

Post 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
User avatar
srvet_claudio
Posts: 2220
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: HMG 64 Bit C-Syntax

Post by srvet_claudio »

Hi,
see hmg doc:
HMG_parnl(n);
HMG_retnl(n);
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
User avatar
AUGE_OHR
Posts: 2093
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: HMG 64 Bit C-Syntax

Post 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.
have fun
Jimmy
User avatar
srvet_claudio
Posts: 2220
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: HMG 64 Bit C-Syntax

Post 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.
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
User avatar
AUGE_OHR
Posts: 2093
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: HMG 64 Bit C-Syntax

Post 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
have fun
Jimmy
User avatar
srvet_claudio
Posts: 2220
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: HMG 64 Bit C-Syntax

Post 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"
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
User avatar
AUGE_OHR
Posts: 2093
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: HMG 64 Bit C-Syntax

Post 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
:(
have fun
Jimmy
User avatar
srvet_claudio
Posts: 2220
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: HMG 64 Bit C-Syntax

Post by srvet_claudio »

Put the include into c code.
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
Post Reply