Page 1 of 1

Bug with #PB_Compiler_ExecutableFormat ???

Posted: Tue Aug 29, 2023 12:43 am
by Gérard
Hello,
Can you check if by modifying the menu Compiler/Compiler Options.../Executable format: with the 3 possible values, there is indeed a bug with the Shared Dll option
The Windows and Console options do return the correct value for #PB_Compiler_ExecutableFormat, but the Shared Dll option returns the same value as the Windows option.

;Values ​​of the 3 options:
#PB_Compiler_Executable = 0
#PB_Compiler_DLL = 1
#PB_Compiler_Console = 2

;Values ​​returned by #PB_Compiler_ExecutableFormat
;0 if Windows option
;0 if Shared Dll option ---> Should be 1 (Bug?)
;2 if Console option

Thanks for trying,
Gérard

Test code:

Code: Select all

CompilerSelect #PB_Compiler_ExecutableFormat
  CompilerCase #PB_Compiler_Executable ; 0
    CompilerError "Option Windows : "    +#PB_Compiler_ExecutableFormat
    
  CompilerCase #PB_Compiler_DLL        ; 1
    CompilerError "Option Shared Dll : "+#PB_Compiler_ExecutableFormat
    
 CompilerCase #PB_Compiler_Console     ; 2
    CompilerError "Option Console : "   +#PB_Compiler_ExecutableFormat
    
 [CompilerDefault]
    CompilerError "Option autre : "     +#PB_Compiler_ExecutableFormat
CompilerEndSelect

Re: Bug with #PB_Compiler_ExecutableFormat ???

Posted: Tue Aug 29, 2023 4:14 am
by nsstudios
Edit: the following report was done using the run/compile option, the code was not actually properly compiled.
If it is a bug, I can confirm getting the behavior starting from 5.73 final up to (and including) 6.03 beta 5; in all of those versions, #pb_compiler_executableFormat returns #pb_compiler_executable both when windows and shared dll is selected in compiler options.
Couldn't easily test even older versions.

Re: Bug with #PB_Compiler_ExecutableFormat ???

Posted: Tue Aug 29, 2023 6:23 am
by juergenkulow

Code: Select all

PureBasic 6.02 LTS - C Backend (Linux - x64)
Loading external modules...
Loading 'c' subsystem
Starting compilation...
Starting compilation...
Error: Line 5 - Option Shared Dll : 1
/media/ramdisk/pb602/purebasic/compilers/pbcompilerc Runtime:43 ms
Errorcode: 1

PureBasic 6.02 LTS (Linux - x64)
Loading external modules...
Starting compilation...
Starting compilation...
Error: Line 5 - Option Shared Dll : 1
/media/ramdisk/pb602/purebasic/compilers/pbcompiler Runtime:60 ms
Errorcode: 1

Code: Select all

PureBasic 6.03 beta 5 LTS - C Backend (Windows - x86)
Loading 'C' subsystem
Compiling D:\eform.pb
Loading external libraries...
Starting compilation...
Error: Line 5 - Option Shared Dll : 1
H:\OldPB\PureBasic\603Beta5x86\Compilers\pbcompilerc.exe Runtime:158 ms
Errorcode: 1

PureBasic 6.03 beta 5 LTS (Windows - x86)
Compiling D:\eform.pb
Loading external libraries...
Starting compilation...
Error: Line 5 - Option Shared Dll : 1
H:\OldPB\PureBasic\603Beta5x86\Compilers\pbcompiler.exe Runtime:194 ms
Errorcode: 1
With the command line and with IDE Compiler Executable everything runs correctly.

Re: Bug with #PB_Compiler_ExecutableFormat ???

Posted: Tue Aug 29, 2023 10:42 am
by Gérard
Thanks for the confirmation, maybe Fred can fix this in the next version of PB

Gérard

Re: Bug with #PB_Compiler_ExecutableFormat ???

Posted: Tue Aug 29, 2023 11:17 am
by STARGÅTE
No problem here (PB 6.01 LTS).

Depending on the selected option in the settings, it gives me 0, 1 or 2 during compilation.

Hint: You have to create the compilation actually. Just pressing "compile/run", always creates an executable (and no DLL), because you can not "run" a DLL.

Re: Bug with #PB_Compiler_ExecutableFormat ???

Posted: Tue Aug 29, 2023 11:24 am
by nsstudios
STARGÅTE wrote: Tue Aug 29, 2023 11:17 am Hint: You have to create the compilation actually. Just pressing "compile/run", always creates an executable.
I was just using the compile/run option, so that explains it.
I don't think I'm the only one who expected the executable that gets generated in order to let you test the dll without compiling the actual dll and having to call it from somewhere would set its flag to dll executable format, too, so that the check for executable format could also be properly tested; if I am, I'm sorry, also doubly sorry for contributing bad data/making things confusing if the original question/report was doing it correctly.