The equivalent of HB_WIN_OS in prg ?

81 views
Skip to first unread message

Francesco Perillo

unread,
Jul 3, 2026, 1:45:54 PM (2 days ago) Jul 3
to harbou...@googlegroups.com

I see that in c code we can use HB_WIN_OS to guard for windows specific code.

I also see that in harbour that define is not valid and I temporarily added a 
{allwin}-DHB_OS_WIN
to my hbmk.hbm, but I'd prefer to use some native define.

Should I use __PLATFORM__WINDOWS ? 

Francesco

miro....@gmail.com

unread,
6:06 PM (24 minutes ago) 6:06 PM
to Harbour Users
codex:
Yes. For Harbour .prg / .ch preprocessor guards, use:

  #if defined( __PLATFORM__WINDOWS )
     // Windows-specific Harbour code
  #endif

  HB_OS_WIN is a C-side macro from Harbour headers. I would not define HB_OS_WIN manually in hbmk.hbm, because it makes PRG code look like it is using the C
  API’s platform layer.

  Minor note: in the installed Harbour headers here the C macro is HB_OS_WIN, not HB_WIN_OS.

  For .hbm build filters, {allwin} is still fine when you need Windows-only build options, but for Harbour source guards __PLATFORM__WINDOWS is the native
  symbol to use.
Reply all
Reply to author
Forward
0 new messages