Page 2 of 2

Re: Compiler Options in source code

Posted: Tue May 14, 2019 4:58 pm
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")