BCX Command Line Usage

Purpose: BC, typed on a command line, invokes the BCX translator, with the options specified, will translate a BCX BASIC file to a C language file.


Usage:

  BC Infile[.bas] [Options]

Parameters:

  • Infile [.bas] The name of the file to be translated. The file name can have any or no extension. If no extension is given, BCX assumes the file ends in .BAS.
  • Options Please note that the order of the command line arguments is important. The options must follow the name of the file to be translated.
    • -b Build using user-defined bat file .. ex -b:c:\bat\pw.bat
    • -c Generate C++ Compatible code
    • -d: Define a constant ... ex. BC MyFile -d:MyConst[=SomeValue]

      The -d switch allows a defined constant to be inserted from the command line. If BCX is invoked like so:

        
       BC Myfile -d:qwerty
      
      

      the following would be in the resulting C file:

        
       #define qwerty
      
      

      Likewise, if BCX was invoked like so:

        
       BC Myfile -d:qwerty=12345
      
      

      the following would be in the resulting C file:

        
       #define qwerty 12345
      
      

      BCX has the ability to specify multiple defines in the command line, for example,

        
       BC test -D:__POCC__=400 -d:OLESUPPORT
      
      
    • -e Write ERRORS to BCX.ERR file
    • -f Write C output file to specified path\filename.ext, for example,
        
       BC MyFile -f:C:\MyFiles\MyFile.c
      
      
    • -h Generate HEADER file for use with $Project. When the -h switch is used the file is created with the extension of .bh for BCX header.
    • -i Send Warnings and Errors to INFOBOX
    • -k Kill the generated BCX generated 'C' file
    • -l Create Runtime LIBRARY source and header Files
    • -m Enable embedded BCX Code in the C translation
    • -n Enable NO RUNTIME Code Generation
    • -o Output a copy of the generated C file to STDOUT
    • -q QUIET - No output to screen during translation
    • -r Update BCX Path variable in the Windows REGISTRY

      The -r switch is for setting or updating the BCX path key in the Windows Registry. The path is set to the directory in which BC.EXE is located. The BCXPATH$ function relies on the registry entry for its return value.

      When the -r switch is invoked nothing else is allowed on the command line.

    • -s Show STATUS of translation by line number
    • -u Turn UNICODE Support ON. This switch emits _UNICODE AND UNICODE macros before any Windows header. This is required for full support of BCX COM functions when UNICODE is defined.
    • -v Show BCX version and build information
    • -w Enable WARNINGS during translation
    • -x Exclude Win32 headers from the resulting C file
    • -z Exclude default headers and libraries from the resulting C file. If the BCX command line option -z is not used, the following .lib files, automatically emitted in the C code by using #pragma directives, do not have to be linked explicitly;
      
       kernel32.lib
       user32.lib
       gdi32.lib
       comctl32.lib
       advapi32.lib
       winspool.lib
       shell32.lib
       ole32.lib
       oleaut32.lib
       uuid.lib
       odbc32.lib
       odbccp32.lib
       winmm.lib
       comdlg32.lib
       imagehlp.lib
       version.lib
      
      

Using the BCX Translator BCX.INI file

BCX.INI provides an easy way to automatically include all your favorite types, variables, constants, and code in all your programs.

If it is to be used, BCX.INI is a user defined BASIC source code file that must reside, either, in the same directory as the BCX translator (BC.EXE), or, in the current directory.

For example, if you create a BCX.INI that contains the following


 SUB Foo(A$)
  MSGBOX A$
 END SUB

then your main file could be the ONE LINE program :


 Foo("Hello From BCX.INI")

If BCX can translate it, you can put it in the BCX.INI, including macros, inline C, comments, directives, whatever.

As one's personal BCX.INI grows, one may want to consider using the conditional compilation directives: $IF, $ELSE, $ELSEIF, $ENDIF to conditionally $INCLUDE other BASIC files into BCX.INI, instead of keeping them all in BCX.INI.

$NOINI directive

If you have created a BCX.INI file, BCX by default, will automatically include the contents of this BCX.INI each time BCX is invoked. This behavior can be disabled by placing the $NOINI directive at the beginning of your source code file, before any code or variable declarations.