[Implemented] Compiler directive for Output compliation

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
localmotion34
Enthusiast
Enthusiast
Posts: 665
Joined: Fri Sep 12, 2003 10:40 pm
Location: Tallahassee, Florida

[Implemented] Compiler directive for Output compliation

Post by localmotion34 »

it'd be nice to have a "#PB_output_type" to denote whether we are compiling a DLL or EXE. i have some sources with procedures that use global hooks, which must of course be in a shared DLL. they are part of a larger project that id like to make available as a .pbi, a DLL, and a PB tailbite LIB.

i hate maintaining three separate sources, as i have to continually copy and paste updated procedures between each. it would be nice to have this:

Code: Select all

compilerif Outputtype()=#pb_shared_DLL

procedure global_hook_procedure(parameter, hinstance)

do something

endprocedure

procedure1(value.l)
set the hook in the DLL
endprocedure

compilerendif 
then i can always maintain a windowed program even inside a DLL source for testing purposes of the procedures, instead of having to compile the DLL, switch back to the exe source, fix that ect. essentially it would make things easier and mgiht add some advantages people hadnt thought of.

Code: Select all

compilerif Outputtype()=#pb_exe

window=openwindow(..........

repeat

until event loop = done

compilerendif

Code: Select all

!.WHILE status != dwPassedOut
! Invoke AllocateDrink, dwBeerAmount
!MOV Mug, Beer
!Invoke Drink, Mug, dwBeerAmount
!.endw