$PRJ and $PRJUSE directives
These directives are used to support an alternative for programmers wishing to use an .obj approach to linking rather than using the BCX $INCLUDE directive. This also allows using a makefile and the compiler's MAKE utility for compiling projects.
Syntax: $PRJ
Purpose: $PRJ suppresses runtime code emission and generates three files: FileName.c, FileName.h and FileName.use.
Syntax: $PRJUSE FileName.use
Purpose: $PRJUSE instructs BCX to include the FileName.use modules prototypes and runtimes in the translated file.
Remarks: $PRJ and/or $PRJUSE are placed at the beginning of files to be compiled into separate objects(.obj files).
You can use both $PRJUSE and $PRJ in the same file with $PRJUSE being placed before $PRJ. This would be where A calls B and B calls C.
Use of the $PRJ and $PRJUSE directives requires some knowledge of how the C-code linker functions and of the programming requirements of this essentially C language approach. See the C-code linker documentation for more details.
Here is a complete multi-file project example. Study it and the generated C code to get a basic understanding of how this works.
File 1. Build.bat for Pelle's C.
bc level1a -p bc level1 -p bc level2 -p bc main -p pocc -W1 -Ot -Gd -Ze -Zx -Tx86-coff level1a.c pocc -W1 -Ot -Gd -Ze -Zx -Tx86-coff level1.c pocc -W1 -Ot -Gd -Ze -Zx -Tx86-coff level2.c pocc -W1 -Ot -Gd -Ze -Zx -Tx86-coff main.c polink -release -machine:ix86 -subsystem:console main.obj level1.obj level2.obj level1a.obj kernel32.lib advapi32.lib delayimp.lib user32.lib gdi32.lib comdlg32.lib ECHO Finished!
File 2. level1a.bas
$PRJ$NOMAINCONSTT$="JFLMGNOPBQHIRSCTUEVWKDXAYZjfkmgnopbqhirsctuevwkdxayz"FUNCTIONTrans$(i$)DIMa, b$, c b$=i$FORa=1TOLEN(i$)c=ASC(MID$(i$,a,1))IF(c >64ANDc <91)OR(c >96ANDc <123)THENc=c-65IFc >26THENc=c-6MID$(b$,a,1)=MID$(T$,c,1)ENDIFNEXTFUNCTION=b$ENDFUNCTION
File 3. level1.bas
$PRJ$NOMAINSUBLEVEL1DIMRAWiOPEN"test"FOROUTPUTAS1FORi=1TO10CHR$(i+48)NEXTiCLOSE1ENDSUB
File 4. level2.bas
$PRJUSElevel1a.use$PRJ$NOMAINSUBLEVEL2(a$)DIMRAWiFORi=1TO10MID$(a$,i)(MID$(a$,i))NEXTiENDSUB
File 5. main.bas
$PRJUSE level1.use level2.use CALL LEVEL1 CALL LEVEL2("testing")