Restart Compiler

Working on new editor enhancements?
User avatar
Progi1984
Addict
Addict
Posts: 806
Joined: Fri Feb 25, 2005 1:01 am
Location: France > Rennes
Contact:

Restart Compiler

Post by Progi1984 »

Hello all, I use PB 4.20 & 4.30.

Actually, I look for a solution for restarting a compiler by code under Windows & Linux. Have you got some code ?

Thanks for advance...
Bye
Last edited by Progi1984 on Sat Nov 22, 2008 3:09 pm, edited 1 time in total.
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Post by Mistrel »

There was something for this in 4.0 or 4.10 but it was removed when the compiler switched from messages to piped input/output.
Fred
Administrator
Administrator
Posts: 18171
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

I don't understand, what do you mean by restarting the compiler ? If it's the same IDE functionnality, we ends it (with a QUIT message) and we really reload the executable.
User avatar
Progi1984
Addict
Addict
Posts: 806
Joined: Fri Feb 25, 2005 1:01 am
Location: France > Rennes
Contact:

Post by Progi1984 »

By restarting the compiler, I wish that the compiler detects again all new userlibs created or userlibs created back.

Par redémarrer le compilateur, je souhaite que le compilateur détecte toutes les nouvelles userlibs créés ou celles recréés/modifiés.

What you said means that ?

Code: Select all

I connect to pbcompiler with -sb argument. I send an END command. I reconnect to pbcompiler with -sb argument.
Have you any small code for explaining your "dires"?
Fred
Administrator
Administrator
Posts: 18171
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

Yes, that's it.
User avatar
Progi1984
Addict
Addict
Posts: 806
Joined: Fri Feb 25, 2005 1:01 am
Location: France > Rennes
Contact:

Post by Progi1984 »

Is this code correct ? For Windows & Linux ?

Code: Select all

Global hCompiler.l
ProcedureDLL PB_Connect()
  Protected ReponseComp.s
  ; hCompiler = RunProgram(#PB_Compiler_Home+"compilers\pbcompiler.exe", "/STANDBY", "", #PB_Program_Open|#PB_Program_Read|#PB_Program_Write|#PB_Program_Hide)
  hCompiler = RunProgram(#PB_Compiler_Home+"compilers/pbcompiler", "-sb", "", #PB_Program_Open|#PB_Program_Read|#PB_Program_Write|#PB_Program_Hide)
  If hCompiler = 0
    ProcedureReturn #False
  Else
    While ProgramRunning(hCompiler)
      If AvailableProgramOutput(hCompiler)
        ReponseComp = ReadProgramString(hCompiler)
        Debug ReponseComp
        If ReponseComp = "READY"
          ProcedureReturn #True
        EndIf
      EndIf
    Wend
  EndIf
EndProcedure
ProcedureDLL PB_RestartCompiler()
  Protected ReponseComp.s
  WriteProgramStringN(hCompiler, "END")
  CloseProgram(hCompiler)
  ProcedureReturn PB_Connect()
EndProcedure

If PB_Connect() = #True
  Debug #True
  Debug PB_RestartCompiler()
EndIf
Last edited by Progi1984 on Sat Nov 22, 2008 5:45 pm, edited 1 time in total.
Fred
Administrator
Administrator
Posts: 18171
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

Looks good.
User avatar
Progi1984
Addict
Addict
Posts: 806
Joined: Fri Feb 25, 2005 1:01 am
Location: France > Rennes
Contact:

Post by Progi1984 »

Thanks :)
Post Reply