PureBasic Forum
https://www.purebasic.fr/english/

#PB_Macro for Defined()
https://www.purebasic.fr/english/viewtopic.php?f=3&t=73169
Page 1 of 1

Author:  infratec [ Wed Jul 10, 2019 1:50 pm ]
Post subject:  #PB_Macro for Defined()

Hi,

I just came accross a problem:
I need to know if a Macro is already defined (many include files :( )

I tried to use
Code:
CompilerIf Not Defined()


But ...

#PB_Macro does not exist.

Author:  skywalk [ Wed Jul 10, 2019 1:56 pm ]
Post subject:  Re: #PB_Macro for Defined()

Yeah, I check a constant defined within my common macros.
Undefine macro
Define macro could be a workaround?

Author:  Little John [ Thu Jul 11, 2019 3:10 am ]
Post subject:  Re: #PB_Macro for Defined()

Hi,

this was discussed before:
viewtopic.php?f=13&t=46310

Anyway, it's good to have a feature request for it now in the appropriate forum section.

Author:  acreis [ Fri Jul 12, 2019 8:04 pm ]
Post subject:  Re: #PB_Macro for Defined()

Code:
Macro CompilerIfNotDefinedMacro(_Macro_Name_)

CompilerIf Defined(_Macro_Name_#_Defined_, #PB_Constant) = 0
  #_Macro_Name_#_Defined_ = 1
 
  EndMacro
 
 
 
CompilerIfNotDefinedMacro(MyMacro)
 
  Macro MyMacro()
   
    Debug 14
   
  EndMacro   
 
CompilerEndIf


CompilerIfNotDefinedMacro(MyMacro)

Macro MyMacro()
   
    Debug 25
   
  EndMacro   
 
CompilerEndIf

MyMacro()

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/