Compiler Options in source code

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
kenmo
Addict
Addict
Posts: 2033
Joined: Tue Dec 23, 2003 3:54 am

Re: Compiler Options in source code

Post by kenmo »

Michael Vogel wrote:...but also a CheckCompilerOptions("..."), which could be placed into a (generally used) include file could help a little bit - so here's a simple start:
I use variations of:

Code: Select all

Macro CompilerRequire(Expression, ErrorMessage = "Failed requirement")
  CompilerIf (Not (Expression))
    CompilerError ErrorMessage
  CompilerEndIf
EndMacro

CompilerRequire(#PB_Compiler_Unicode)
CompilerRequire(#PB_Compiler_Thread, "Threadsafe mode must be enabled")
CompilerRequire(#PB_Compiler_OS <> #PB_OS_Linux, "This module is not implemented on Linux")
CompilerRequire(SizeOf(INTEGER) = 8, "Must use 64-bit compiler")
Post Reply