Microsoft KB Archive/66428

{|
 * width="100%"|

FILE: Link Basic 7.1 with C 5.1, FORTRAN 5.0, and Pascal 4.0

 * }

Q66428

-

The information in this article applies to:


 * Microsoft Basic Professional Development System (PDS) for MS-DOS and MS OS/2, version 7.1

-

SUMMARY
This article explains how to get some library files from the Microsoft Software library, and it describes how to link Microsoft Basic PDS version 7.1 with C version 5.1, FORTRAN version 5.0, or Pascal version 4.0 for MS- DOS. It is designed only for owners of Microsoft Basic Professional Development System (PDS) version 7.1, Microsoft C Compiler version 5.1, Microsoft FORTRAN Compiler version 5.0 or 5.1, and Microsoft Pascal Compiler version 4.0 for MS-DOS.

If you have FORTRAN Compiler version 5.1, please also review the following article in the Microsoft Knowledge Base:

"Q79825 BUG: Initialization Problem with FORTRAN and Basic"

MORE INFORMATION
The following file is available for download from the Microsoft Software Library:

"BB0345.EXE" For more information about downloading files from the Microsoft Software Library, please see the following article in the Microsoft Knowledge Base:

"Q119591 How to Obtain Microsoft Support Files from Online Services" Run BB0345.EXE in an empty directory to get the following three files: LLIBCER.LIB, LLIBCAR.LIB, and READ.ME. The READ.ME file repeats all information from this article.

====================================================================== HOW TO LINK Basic PDS 7.1 WITH C 5.1, FORTRAN 5.0, OR PASCAL 4.0

=
=========================================================

Introduction
This article describes how to link Basic Professional Development System (PDS) version 7.1 with C 5.1, FORTRAN 5.0, or Pascal 4.0.

This information applies only to Microsoft Basic PDS version 7.1, Microsoft C Compiler version 5.1, Microsoft FORTRAN Compiler version 5.0, and Microsoft Pascal Compiler version 4.0 for MS-DOS.

Basic programs compiled with Microsoft Basic PDS 7.1 use the Microsoft C version 6.0 and QuickC 2.50 format for start-up code and memory allocation. This format has changed so dramatically between C 5.1 and C 6.0 that Basic PDS 7.1 is not directly compatible with C 5.1, FORTRAN 5.0, or Pascal 4.0 (which use the C 5.1 format for start-up code and memory allocation).

"NOTE: Microsoft Basic PDS 7.1 is compatible with Microsoft C PDS 6.0. Basic PDS 7.0 is compatible with C 5.1, but Basic PDS 7.1 is not directly compatible with C 5.1 unless you use the method described in this application note." To make Basic PDS 7.1 compatible with C 5.1, FORTRAN 5.0, or Pascal 4.0, you must alter the FORTRAN or Pascal language libraries and incorporate modules from the C 6.0 run-time libraries, as explained further below.

The files you downloaded from the MSL include the following two C 6.0 run- time libraries (which were built by running the C 6.0 SETUP.EXE program and choosing no GRAPHICS.LIB and no PGCHART.LIB included in the combined libraries):

"LLIBCER.LIB and LLIBCAR.LIB" These provided files support only the large memory model, the emulation and alternate math packages, and the MS-DOS (or real mode under OS/2) operating system.

Pascal 4.0
To make Basic PDS 7.1 compatible with Pascal 4.0, perform the following steps:

 Make a copy of the Pascal run-time library that you want to make compatible with Basic PDS 7.1. (You must keep a separate copy of the original unmodified Pascal run-time library so you can continue to link Pascal 4.0 programs when not using mixed-language calls.)  Remove the following modules from the Pascal 4.0 run-time library: CRT0, FMALLOC, AMALLOC, NMALLOC, and PNMSIZE.

An example of removing these modules from the LIBPASE.LIB library using the LIB.EXE utility is as follows: "LIB LIBPASE.LIB -CRT0 -FMALLOC -AMALLOC -NMALLOC -PNMSIZE;" Name your new Pascal library Newmixed.LIB (where Newmixed is the filename you assign); it is now a Pascal run-time library that has all of the conflicting code removed.  Remember that this application note provides large memory model support libraries (LLIBCER.LIB and LLIBCAR.LIB) from C 6.0; thus, you must design your Pascal program to follow the conventions of programming in a large memory model. Please read the &quot;Linking Your Compiled Programs&quot; section further below.

FORTRAN 5.0
To make Basic PDS 7.1 compatible with FORTRAN 5.0, perform the following steps:

 Make sure you have built the FORTRAN 5.0 library to be run-time compatible with C. Make a copy of the FORTRAN run-time library you want to modify for Basic PDS 7.1 compatibility. (You must keep a separate copy of the original unmodified FORTRAN run-time library so you can continue to link FORTRAN 5.0 programs when not using mixed-language calls.)  Remove the CHKSTK module from the copy of the FORTRAN run-time library. An example of removing CHKSTK from FORTRAN's LLIBFER.LIB library using the LIB.EXE utility is as follows: "LIB LLIBFER.LIB -CHKSTK;" Name the new FORTRAN library Newmixed.LIB. Once the CHKSTK module has been removed, you should have a FORTRAN run-time library that has all of the conflicting code removed. </li> Remember that this application note provides large memory model support libraries from C 6.0; thus, you must design your FORTRAN program to follow the conventions of programming in a large memory model.</li> Please read the &quot;Linking Your Compiled Programs&quot; section below.</li></ol>

Linking Your Compiled Programs
Once you have modified the Pascal or FORTRAN library (Newmixed.LIB as described above) and you have compiled your Pascal or FORTRAN source file(s), you must link your object modules with the proper libraries in the proper order. In the LINK command line, you must specify the Basic library first, the C 6.0 library LLIBCER.LIB or LLIBCAR.LIB (included with this application note) second, and your new Pascal or FORTRAN library (Newmixed.LIB) last. You also must link with the /NOD and /NOE options to ensure that the default libraries the object files normally use are ignored and only the libraries you explicitly list are used. The following is an example

"LINK /NOD/NOE Bas1.OBJ + Mixed.OBJ, Bas1.EXE,,BRT71ENR.LIB + LLIBCER.LIB + Newmixed.LIB;" where Bas1.OBJ is your Basic main program, and Mixed.OBJ is your Pascal or FORTRAN object module.

C 5.1
To make Basic PDS 7.1 compatible with C 5.1, you must use a method different from the method used above for Pascal or FORTRAN.

Because the Basic PDS 7.1 and C 5.1 libraries aren't designed to be compatible, there isn't an easy way to make the two libraries work together. In this case, you must use the provided C 6.0 run-time libraries, which provide support for emulator (/FPi) (LLIBCER.LIB) and support for alternate math (/FPa) (LLIBCAR.LIB) support for MS-DOS.

The following are examples of the required Basic 7.1 and C 5.1 compiling and linking steps

<pre class="CODESAMP">  BC /FPi /O Btest.BAS; CL /c /AL /FPi Ctest.C  LINK /NOD /NOE Btest + Ctest,,,BCL71ENR.LIB LLIBCER.LIB; where the LLIBCER.LIB file above is one of the two C 6.0 libraries (LLIBCER.LIB or LLIBCAR.LIB) provided with this application note. (Don't use the C 5.1 run-time library of the same name.)

Final Note on Compatibility
Although the above methods have been designed to produce compatible results, we have not put them through a standard Microsoft mixed- language testing cycle, and it is possible that you may still encounter compatibility problems under certain conditions. We cannot guarantee the complete success of mixed-language programming of Basic 7.1 with C 5.1, FORTRAN 5.0, or Pascal 4.0. Further problems or questions can be directed to Microsoft Language Support Services.

Additional query words: BasicCom softlib BB0345.EXE kbfile

Keywords :

Issue type :

Technology : kbAudDeveloper kbBASICSearch kbBASICPDS710DOS kbBASICPDS710OS2