[DONE] PB consolen compiler option

Just starting out? Need help? Post your questions and find answers here.
User avatar
tft
User
User
Posts: 84
Joined: Mon Dec 29, 2008 9:34 am

[DONE] PB consolen compiler option

Post by tft »

Hallo ...

I use the Console Compiler to create an executable program at runtime in order to start it afterwards.
That's what the function does CreateAndRunProcess(pfad.s,file.s) .
What am I doing wrong?

consolen compiler option -e or /EXE create the executable
RunProgram(CompilerPfad.s,file.s+".pb -e "+file.s+".exe",pfad.s,#PB_Program_Wait )
RunProgram(CompilerPfad.s,file.s+".pb /EXE "+file.s+".exe",pfad.s,#PB_Program_Wait )

ThreadSave -t not work?
RunProgram(CompilerPfad.s,file.s+".pb /EXE /TREAD "+file.s+".exe",pfad.s,#PB_Program_Wait )

Code: Select all


Procedure DebugLog(Text.s)
endprocedure

Procedure CreateAndRunProcess(pfad.s,file.s)
    
    Protected FileName.s = pfad.s+file.s
    
    ; Teilprogramm Compilieren
    If FileSize(FileName.s+".exe") >0
      DeleteFile(FileName.s+".exe")
    EndIf
    Delay(100)
    If FileSize(FileName.s+".pb") >0
      DebugLog("Compile "+file.s+".pb")
      RunProgram(CompilerPfad.s,file.s+".pb -e "+file.s+".exe",pfad.s,#PB_Program_Wait )
    Else
      DebugLog("Source "+file.s+".pb Not found")
    EndIf
    Delay(100)
    ; Teilprogramm starten als Prozess-
    If FileSize(FileName.s+".exe") >0
      DebugLog("Run "+file.s+".exe")
      RunProgram(FileName.s+".exe","CARP",pfad.s,#PB_Program_Open   )
    Else
      DebugLog("Prozess "+file+".exe Not found")
    EndIf
    
EndProcedure
Last edited by tft on Wed Aug 24, 2022 8:04 am, edited 1 time in total.
TFT seid 1989
Aktuelles Projekte : Driving School Evergarden
YouTube : Pure Basic to go
FaceBook : Temuçin SourceMagic Games
DISCORD : SourceMagic
W10 , i9 9900K ,32 GB Ram , GTX Titan , 3 Monitore FHD
ARDUINO Freak :-)
Marc56us
Addict
Addict
Posts: 1477
Joined: Sat Feb 08, 2014 3:26 pm

Re: [HELP] PB consolen compiler option

Post by Marc56us »

consolen compiler option -e or /EXE create the executable
RunProgram(CompilerPfad.s,file.s+".pb -e "+file.s+".exe",pfad.s,#PB_Program_Wait )
RunProgram(CompilerPfad.s,file.s+".pb /EXE "+file.s+".exe",pfad.s,#PB_Program_Wait )
/OUTPUT "Filename": Create an executable or a dll to the given filename
ThreadSave -t not work?
RunProgram(CompilerPfad.s,file.s+".pb /EXE /TREAD "+file.s+".exe",pfad.s,#PB_Program_Wait )
.H...
/THREAD: Use thread safe runtime for strings and general routines

Test in console before include in code,check exact syntax
pbcompiler.exe /?
:wink:
User avatar
tft
User
User
Posts: 84
Joined: Mon Dec 29, 2008 9:34 am

Re: [HELP] PB consolen compiler option

Post by tft »

Hallo,

this is the String to create and not work.

E:\PureBasic_600\Compilers\pbcompiler.exe 3D-Video-Process.pb /EXE /THREAD 3D-Video-Process.exe

RunProgram(CompilerPfad.s,file.s+".pb /EXE /THREAD "+file.s+".exe",pfad.s,#PB_Program_Wait )

am i too stupid?
TFT seid 1989
Aktuelles Projekte : Driving School Evergarden
YouTube : Pure Basic to go
FaceBook : Temuçin SourceMagic Games
DISCORD : SourceMagic
W10 , i9 9900K ,32 GB Ram , GTX Titan , 3 Monitore FHD
ARDUINO Freak :-)
User avatar
mk-soft
Always Here
Always Here
Posts: 5335
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: [HELP] PB consolen compiler option

Post by mk-soft »

example
Compiler File Path: "E:\PureBasic_600\Compilers\pbcompiler.exe"
Compiler Parameters: "[path]\filename.pb" --thread --unicode --output "[path]\filename.exe"
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
User avatar
mk-soft
Always Here
Always Here
Posts: 5335
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: [HELP] PB consolen compiler option

Post by mk-soft »

Short running example (windows)

Update

Code: Select all

;-TOP

compilerPath.s = #PB_Compiler_Home + "compilers\"
compilerProg.s = compilerPath + "pbcompiler.exe"

compilerParam.s = #DQUOTE$ + "%filename%.pb" + #DQUOTE$ + " --thread --unicode --output " + #DQUOTE$ + "%filename%.exe"

filename.s = OpenFileRequester("PB-File", "", "", 0)
If filename
  filename = GetPathPart(filename) + GetFilePart(filename, #PB_FileSystem_NoExtension)
  compilerParam = ReplaceString(compilerParam, "%filename%", filename)
  Debug "Compiler: " + compilerProg
  Debug "Parameters: " + compilerParam
  
  r1 = RunProgram(compilerProg, compilerParam, compilerPath, #PB_Program_Wait)
  If r1
    If RunProgram(filename)
      Debug "Running " + filename
    EndIf
  EndIf
EndIf

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
User avatar
tft
User
User
Posts: 84
Joined: Mon Dec 29, 2008 9:34 am

Re: [HELP] PB consolen compiler option

Post by tft »

Hallo ... and THX

" --thread --unicode --output " it is work fine.

Code: Select all


RunProgram(CompilerPfad.s,file.s+".pb --thread --unicode --output "+file.s+".exe",pfad.s,#PB_Program_Wait )
TFT seid 1989
Aktuelles Projekte : Driving School Evergarden
YouTube : Pure Basic to go
FaceBook : Temuçin SourceMagic Games
DISCORD : SourceMagic
W10 , i9 9900K ,32 GB Ram , GTX Titan , 3 Monitore FHD
ARDUINO Freak :-)
Post Reply