Ceiling() function with Macro

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
sudip
Posts: 1456
Joined: Sat Mar 07, 2009 11:52 am
Location: Kolkata, WB, India

Ceiling() function with Macro

Post by sudip »

Hello All,

I found some problem with using CEILING() function with Macro. Interestingly I found it works, only if I call CEILING() function directly as a dummy function!!! ;)
Ceiling_Macro.jpg
Ceiling_Macro.jpg (18.53 KiB) Viewed 2416 times

Code: Select all

#include <hmg.ch>

Function Main

   DEFINE WINDOW main at 0, 0 width 450 height 300  TITLE "Macro Test with CEILING() function!!!" MAIN
   
      DEFINE TEXTBOX Text_1
         ROW    50
         COL    80
         INPUTMASK "9999.999"
         FORMAT Nil
         NUMERIC .T. 
      END TEXTBOX
   
      DEFINE BUTTON Button_1
         ROW    50
         COL    300
         ACTION test1()
         CAPTION "Gives Error!!!"
      END BUTTON
   
   END WINDOW

   Main.Text_1.value := 100.001   
   Main.Center
   Main.Activate

Return                


function Test1()
   local x := "CEILING("+str(main.text_1.value)+")"
   // dummy 
   //CEILING(1) // but runs fine when you clear the comments of this line before ceiling()!!!   
   msgbox(str(&x))
   return nil
I have very little knowlege on macro. So, can you please help me to understand the behavior :)

Thanks in advance. :)

With best regards.

Sudip
With best regards,
Sudip
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Ceiling() function with Macro

Post by esgici »

Hi Sudip

REQUEST CEILING

Regards

--

Esgici
Viva INTERNATIONAL HMG :D
User avatar
Czarny_Pijar
Posts: 172
Joined: Thu Mar 18, 2010 11:31 pm
Location: 19.2341 E 50.2267 N

Re: Ceiling() function with Macro

Post by Czarny_Pijar »

sudip
Try other functions ( SIN, TAN ) - the result is the same.
I guess this is not macro related behaviour, this is the dynamic linking factor, where only the functions spotted in the code are included in the exe file. As esgici suggested, you have to explicity inform the linker, which functons haven't to be omitted.
User avatar
sudip
Posts: 1456
Joined: Sat Mar 07, 2009 11:52 am
Location: Kolkata, WB, India

Re: Ceiling() function with Macro

Post by sudip »

Thanks lot Esgici, Czarny Pijar :)
It works :)
With best regards,
Sudip
Post Reply