Does --PureLibrary and #PB_Compiler_IsMainFile make sense?

Just starting out? Need help? Post your questions and find answers here.
Axolotl
Addict
Addict
Posts: 890
Joined: Wed Dec 31, 2008 3:36 pm

Does --PureLibrary and #PB_Compiler_IsMainFile make sense?

Post by Axolotl »

Hi All.
I started my adventure with --PureLibrary finally and came across the following.
I love to enclose my tests in include files with

Code: Select all

 CompilerIf #PB_Compiler_IsMainFile  ;-{·} TEST Area 
 CompilerEndIf 
My observation is that it doesn't work so well.
How do you do it? Separate Files?
Maybe the command should also work within the created libraries?
This is how I do it now:

Code: Select all

 CompilerIf 0 ; #PB_Compiler_IsMainFile  ;-{·} TEST Area 
 CompilerEndIf 
TIA for your thoughts.
Just because it worked doesn't mean it works.
PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).
User avatar
mk-soft
Always Here
Always Here
Posts: 6388
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Does --PureLibrary and #PB_Compiler_IsMainFile make sense?

Post by mk-soft »

I tried it out quickly.
Unfortunately, the area in #PB_Compiler_IsMainFile is also compiled.
As well as setting '0' ...

Small help tool
Link: IDE-Tool Build Library for all OS

Library Example Format String as Library
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Fred
Administrator
Administrator
Posts: 18383
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Does --PureLibrary and #PB_Compiler_IsMainFile make sense?

Post by Fred »

I guess it should be supported for pure library as well, I will take a closer look
User avatar
pf shadoko
Enthusiast
Enthusiast
Posts: 426
Joined: Thu Jul 09, 2015 9:07 am

Re: Does --PureLibrary and #PB_Compiler_IsMainFile make sense?

Post by pf shadoko »

To test :

Code: Select all

CompilerIf #PB_Compiler_Debugger
...
CompilerEndIf
Post Reply