Page 1 sur 1

Compilation

Publié : sam. 30/juin/2007 13:15
par Jeff
bonjour la communauté :D

Dans l'aide de PB je n'ai pas vu de ligne pour lancer la compilation d'un fichier *.pb par un programme.

J'ai regardé les sources de JABPE mais c'est quelque peu confus...

Avez-vous des exemples de codes ?

Note: Je reflechis à coder un petit IDE.

@+

JF

Publié : sam. 30/juin/2007 13:42
par wolfjeremy
Tu doit envoyé un message au compilateur via l'invite de commande, je ne sais plus exactement quoi.

Publié : sam. 30/juin/2007 16:35
par minirop

Code : Tout sélectionner

C:\Program Files\PureBasic\Compilers>pbcompiler /?

PBCompiler "FileName"

Options:
--------

/DEBUGGER: Enable the debugger
/EXE "FileName": Create an executable to the given filename
/DLL: Create a DLL
/CONSOLE: Create a console executable
/ICON "FileName": Add an icon to the executable
/RESOURCE "FileName": Add a resource file (.rc) to the executable
/QUIET: Disable all unnecessary textoutput
/COMMENTED: Produce a commented asm output (PureBasic.asm)
/REASM: Compile the 'PureBasic.asm' file to an executable
/XP: Add the Windows XP theme support to the executable
/INLINEASM: Enable the inline ASM support
/RESIDENT "FileName": Create a resident file to the given filename
/IGNORERESIDENT "FileName": ignore the given resident
/LINENUMBERING: Enable line numbering in the final executable for OnError
/STANDBY: Wait for external commands (editor, scripts...)
/MMX, /3DNOW, /SSE or /SSE2: Create a processor specific executable
/DYNAMICCPU: Create a executable containing all processor specific routines
/THREAD: Use thread safe runtime for strings and general routines
/UNICODE: Use unicode instead ascii for strings management
/SUBSYSTEM "Name": Use this subsystem to replace a set of internal functions
/VERSION: Display the version of the compiler

Publié : sam. 30/juin/2007 16:46
par comtois
Exemple de Freak

Et il faut lire le fichier CompilerInterface.txt qui se trouve dans le répertoire SDK.

Code : Tout sélectionner

Compiler = RunProgram(#PB_Compiler_Home+"Compilers\Pbcompiler.exe", "/STANDBY", "", #PB_Program_Open|#PB_Program_Read|#PB_Program_Write|#PB_Program_Hide)
If Compiler = 0
  MessageRequester("", "cannot start compiler")
  End
EndIf

; compiler version
;
Response$ = ReadProgramString(Compiler)
Debug Response$

; Wait for compiler ready
;
Response$ = ReadProgramString(Compiler)

If StringField(Response$, 1, Chr(9)) = "ERROR"
  MessageRequester("", "Error: " + StringField(Response$, 2, Chr(9)))
  CloseProgram(Compiler)
  End
EndIf

; Get a structure def
;
WriteProgramStringN(Compiler, "STRUCTURE"+Chr(9)+"STARTUPINFO")

Repeat
  Response$ = ReadProgramString(Compiler) 
  If Response$ = "OUTPUT"+Chr(9)+"COMPLETE"
    Break
  EndIf 
  Text$ + Response$ + Chr(13)
ForEver

WriteProgramStringN(Compiler, "END")
CloseProgram(Compiler)

MessageRequester("", Text$)

Publié : lun. 02/juil./2007 7:55
par Progi1984
@Comtois : Même avec le nouveau pipe vers le compilateur 4.10 ?

Publié : lun. 02/juil./2007 8:04
par comtois
surtout avec le nouveau pipe.

Je crois que ce fichier CompilerInterface.txt n'existe que depuis la 4.10 pour le nouveau pipe justement. Tout est expliqué, enfin je pense , je n'ai jamais fait d'essais de compilation.
Mais le code ci dessus est intéressant pour récupérer les champs d'une structure, c'est un exemple qui montre comment traiter les commandes (lecture / écriture ) avec le compilo.