Page 1 of 1

easy quick testing with dll's

Posted: Tue Apr 04, 2023 9:39 pm
by jassing
I was testing dll's and was getting annoyed with switching windows for code changes and wanted one file to do it all.
Interesting, I accidentally discovered I don't have to change the output type (compiler->compiler options->Executable Format)
After editing, two steps: 1) Compiler->Create Executable, 2) F5 to build/run
maybe someone else will find it helpful/useful.
Shell of an example:

Code: Select all

;- Create Exec, Build/run DLL
; save file, then set "Executable Format" to DLL
; Create 'executable' test.dll; then hit F5 to run the program.

CompilerIf #PB_Compiler_ExecutableFormat = #PB_Compiler_DLL
  ProcedureDLL times2( n )
    n*2
    ProcedureReturn n
  EndProcedure
CompilerElse
  Import "CEBuildRunTest.lib"
    multiplyBy2(n) As "times2"
  EndImport
  Debug multiplyBy2(10)  
CompilerEndIf

; IDE Options = PureBasic 6.01 LTS (Windows - x64)
; ExecutableFormat = Shared dll
; CursorPosition = 20
; Folding = --
; Optimizer
; EnableThread
; EnableXP
; Executable = CEBuildRunTest.dll
; EnablePurifier
; EnableCompileCount = 55
; EnableBuildCount = 16
; EnableExeConstant