$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
$NOMAIN
CONST
T$=
"JFLMGNOPBQHIRSCTUEVWKDXAYZjfkmgnopbqhirsctuevwkdxayz"
FUNCTION
Trans$(
i$)
DIM
a, b$, c b$=
i$FOR
a=
1
TO
LEN
(
i$)
c=
ASC
(
MID$
(
i$,a,1
)
)
IF
(
c >64
AND
c <91
)
OR
(
c >96
AND
c <123
)
THEN
c=
c-
65
IF
c >26
THEN
c=
c-
6
MID$
(
b$,a,1
)
=
MID$
(
T$,c,1
)
END
IF
NEXT
FUNCTION
=
b$END
FUNCTION
File 3. level1.bas
$PRJ
$NOMAIN
SUB
LEVEL1DIM
RAW
iOPEN
"test"
FOR
OUTPUT
AS
1
FOR
i=
1
TO
10
CHR$
(
i+
48
)
NEXT
iCLOSE
1
END
SUB
File 4. level2.bas
$PRJUSE
level1a.use$PRJ
$NOMAIN
SUB
LEVEL2(
a$)
DIM
RAW
iFOR
i=
1
TO
10
MID$
(
a$,i)
(
MID$
(
a$,i)
)
NEXT
iEND
SUB
File 5. main.bas
$PRJUSE level1.use level2.use CALL LEVEL1 CALL LEVEL2("testing")