KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Article: Q37342
Product(s): See article
Version(s): 6.00 6.00b 7.00 | 6.00 6.00b 7.00
Operating System(s): MS-DOS | OS/2
Keyword(s): ENDUSER | | mspl13_basic
Last Modified: 2-FEB-1990

This information applies to Microsoft BASIC Compiler Versions 6.00 and
6.00b for MS-DOS and MS OS/2 and to Microsoft BASIC Professional
Development System (PDS) Version 7.00 for MS-DOS and MS OS/2.

You can pass variables between BASIC and other languages that have the
alternate math package if each of the modules is compiled using that
option. The error message L2025, "symbol defined more than once",
results from any attempt to link modules that were compiled using
different math package options.

The code example below, which shows a BASIC program calling a C
function, should be compiled and linked using the following syntax:

   bc cf.bas /FPa [other optional switches are OK];
   cl /AM /Gs /FPa /c cfunc.c
   link cf+cfunc /noe;

The alternate math package is not available in QuickBASIC, or in
versions of the BASIC compiler earlier than Version 6.00.

The following is sample code:

' BASIC PROGRAM CF.BAS:
DECLARE function cfunc# CDECL (byval x AS double)
input "enter a floating point number ";x#
print x#;" * 2 = ";cfunc(x#)

/*   C FUNCTION CFUNC.C:   */
   double  cfunc(double value)
   {
      return  (value * 2);
   }

THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Copyright Microsoft Corporation 1986-2002.