Page 1 of 1

HB_FUNC() SYNTAX

Posted: Fri Aug 02, 2019 1:59 am
by jairpinho
Hello, where can I find documentation about the hb_func () function, the types of variables and parameters accepted among other information. where does this function come from? harbour?

Re: HB_FUNC() SYNTAX

Posted: Fri Aug 02, 2019 5:46 am
by bpd2000
Hi
HB_FUNC... used when embedding C-code into .prg file
In the Harbour there is a possibility to insert fragments of C code in the prg file. This may be conveniently, if you don't want to create a .c file for a pair of C functions and then putting it in the project. This can be done with the help of directives #pragma BEGINDUMP ... #pragma ENDDUMP.
HB_FUNC...
{
// C/C++ code
}
#pragma ENDDUMP

Code: Select all

#pragma BEGINDUMP
   #include < extend.h >
   #include < math.h >
   HB_FUNC( SIN )
   {
      double x = hb_parnd(1);
      hb_retnd( sin( x ) );
   }
#pragma ENDDUMP
refer: http://www.kresin.ru/en/hrbfaq_3.html#Doc7
also refer: https://github.com/Petewg/harbour-core/wiki/et-cetera