Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Blinker 5.10 Online Reference - <b> borland c++</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 Borland C++
------------------------------------------------------------------------------
 Blinker supports all versions of Borland C++ for DOS real mode and Windows
 programs, and supports versions 3.1 and later for protected mode programs.
 The following sample programs written in Borland C++ will be used throughout
 this section to illustrate the basics of linking Borland C++ programs with
 Blinker.

 Borland C++ requires the link script to include the start up module C0x.OBJ
 (or C0xPnn.OBJ, from the OBJ subdirectory of the Blinker installation
 directory, for protected mode) as the first FILE. In addition the optional
 libraries EMU.LIB, MATHx.LIB may be required as LIBs, and Cx.LIB and
 optionally GRAPHICS.LIB as the last LIBs, where x is the memory model.
 (GRAPHICS.LIB is not currently supported in protected mode programs).

 Use the Borland global variable _maxfarrealloc to reduce the number of
 selectors allocated to each farmalloc() segment for DOS extended programs.
 Overlaid programs must be compiled to use far calls, i.e. medium, large or
 huge memory model. Extended and dual mode programs must be compiled to use
 large or huge memory model.

 Note: The stack size of a Borland C++ program must be set in the variable
 _stklen from within the program code, not by the STACK link command. (e.g.
 extern unsigned _stklen = 8192;). Please refer to the Borland documentation
 for further details.
 The OBJ subdirectory of the Blinker installation directory contains the
 files FP7BCPnn.OBJ which must be linked to any protected mode programs which
 use LIB FP87 instead of LIB EMU, to force use of the maths coprocessor for
 floating point operations. FP7BCPnn.OBJ should be the second OBJ file in the
 link script, i.e. directly after FILE C0xPnn.OBJ.
 Windows programs may require the IMPORT.LIB library to be explicitly
 SEARCHed to remove the unresolved externals. Simply add the line:

 SEARCH IMPORT

 at the start of the list of libraries if you get unresolved externals on
 Windows API functions.

 TEST.CPP
 void limerick (void);
 void main (void)
 {
    limerick ();
 }
 LIMERICK.CPP
 <include <stdio.h>
 void limerick (void)
 {
    printf ("There was a young fellow from Borland\n");
 }

 The two modules are compiled as large model code as follows :

 BCC -c -ml test.cpp
 BCC -c -ml limerick.cpp

 DOS extended / non-overlaid program

 # TEST.LNK (This is a comment)
 # Comment out the next line for dynamic overlays only
 BLINKER EXECUTABLE EXTENDED   # Create DOS extended program
 FILE c0lpnn                   # Borland C++ startup code
 FILE test
 FILE limerick
 SEARCH blxbcpnn               # Blinker dual mode library
 LIB cl                        # Borland C++ library
 OUTPUT t                      # Output .EXE name
 MIXCASE                       # Make link case sensitive

 This causes Blinker to link the two object modules specified in the FILE
 command (test.obj and limerick.obj) to create a DOS extended program with
 the name t.exe as specified in the OUTPUT command.

 Dual mode / overlaid program

 # TESTDUAL.LNK
 # Comment out the next line for dynamic overlays only
 BLINKER EXECUTABLE DUAL       # Create dual mode program
 BLINKER OVERLAY OPSIZE 50     # 50kb overlay area
 BLINKER OVERLAY PAGEFRAME ON  # Run overlays in pageframe
 BLINKER MESSAGE WINK          # Only wink one eye
 FILE c0lpnn                   # Borland C++ startup code
 FILE test                     # This file is not overlaid
 BEGINAREA                     # Start of overlays
    FILE limerick              # This file is overlaid
 ENDAREA                       # End of overlays
 SEARCH blxbcpnn               # Blinker dual mode library
 LIB emu,mathl,cl              # Libraries not overlaid
 LIB graphics                  # *Not supported in protected mode*
 OUTPUT t                      # Output .EXE name
 MAP A,S                       # Create MAP file
 MIXCASE                       # Make link case sensitive

 16 bit Windows program

 # TESTWIN.LNK
 FILE c0wl      # Borland C++ startup code
 FILE test
 FILE limerick
 LIB cwl        # Borland C++ library
 MIXCASE        # Make link case sensitive
 DEFFILE TEST   # Use TEST.DEF
 ; TEST.DEF
 NAME           TEST
 DESCRIPTION    'Small Windows program'
 EXETYPE        WINDOWS 3.1
 HEAPSIZE       1024
 STACKSIZE      8192

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson