Microsoft KB Archive/27324

= Passing Numeric Variables between Basic and C by Far Reference =

Article ID: 27324

Article Last Modified on 11/21/2006

-

APPLIES TO


 * Microsoft QuickBasic 2.0
 * Microsoft QuickBasic 4.0
 * Microsoft QuickBASIC 4.0b
 * Microsoft QuickBasic 4.5 for MS-DOS
 * Microsoft BASIC Compiler 6.0
 * Microsoft BASIC Compiler 6.0b

-



This article was previously published under Q27324



SUMMARY
The following example demonstrates how to pass numeric values from compiled Basic to Microsoft C by far reference.

This information about inter-language calling applies to QuickBasic Versions 4.00, 4.00b, and 4.50 for MS-DOS and to Microsoft Basic Compiler Versions 6.00 and 6.00b for MS-DOS and MS OS/2.



MORE INFORMATION
For more information about passing other types of parameters between Basic and C, and a list of which Basic and C versions are compatible with each other, query in the Microsoft Knowledge Base using the following word:

BAS2C

Code Example
===== Basic PROGRAM =====

DECLARE SUB NumericFar CDECL (_       BYVAL p1o AS INTEGER, BYVAL p1s AS INTEGER,_        BYVAL p2o AS INTEGER, BYVAL p2s AS INTEGER,_        BYVAL p3o AS INTEGER, BYVAL p3s AS INTEGER,_        BYVAL p4o AS INTEGER, BYVAL p4s AS INTEGER) a% = 32767 b& = 32769 c! = 123.312 d# = 129381.333# CLS CALL NumericFar(VARPTR(a%), VARSEG(a%),_               VARPTR(b&), VARSEG(b&),_                VARPTR(c!), VARSEG(c!),_                VARPTR(d#), VARSEG(d#)) END

C ROUTINE
void NumericFar(a, b, c, d)  int far *a; long far *b; float far *c; double far *d; {        printf(&quot;INTEGER  %d        \n&quot;,*a); printf(&quot;LONG    %ld        \n&quot;,*b); printf(&quot;FLOAT   %f        \n&quot;,*c); printf(&quot;DOUBLE  %lf        \n&quot;,*d); }
 * 1) include 

OUTPUT
INTEGER 32767 LONG    32769 FLOAT   123.311996 DOUBLE  129381.333000

Additional query words: QuickBas BasicCom

Keywords: KB27324

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.