Par2: Compile switch based on whether compiling DLL or EXE
1998-05-16 -- Arnor Baldvinsson
>I have some code I would like to include only if I am compiling an app as
>an EXE. When I switch to DLL I want it to be omitted. Currently I do this by
>commenting/uncommenting the code but I get real interesting results when I
>forget to comment out this code for an EXE . Is there a way to create an
>expression that knows whether we are compiling an EXE or DLL?
Let's see...
#TEMPLATE(MyExtension,'My extension templates'),Family('ABC')
#EXTENSION(CheckTypeOfCompile,'Checking type of compile'),APPLICATION
#GLOBALDATA
Glo:CompileType STRING(3)
#ENDGLOBALDATA
#AT(%ProgramSetup)
#CASE(%ProgramExtension)
#OF('DLL')
Glo:CompileType = 'DLL'
#OF('EXE')
Glo:CompileType = 'EXE'
#OF('LIB')
Glo:CompileType = 'LIB'
#ENDCASE
#ENDAT
If you want to use this with Clarion templates, just change the
Family('ABC') to Family('CLARION')
Then you should be able to do something like this:
Case Glo:CompileType
Of 'DLL'
OfOr 'LIB'
! Execute DLL code or LIB (should normally be the same)
Of 'EXE'
! Execute EXE code
End
Try it, let me know if it works:)
Printed November 21, 2024, 6:28 am
This article has been viewed/printed 35186 times.