Microsoft KB Archive/70666

= Basic PDS Manual Correction Passing Far Strings to C =

Article ID: 70666

Article Last Modified on 10/20/2003

-

APPLIES TO


 * Microsoft BASIC Professional Development System 7.0
 * Microsoft BASIC Professional Development System 7.1

-



This article was previously published under Q70666



SUMMARY
Page 502 of the &quot;Microsoft Basic 7.0: Programmer's Guide&quot; (for versions 7.00 and 7.10) shows an incorrect example of passing multiple far strings to a C program. To correct the problem, add the SEG attribute to OutString1$ and OutString2$ in the DECLARE SUB AddString statement. Also, remove the phrase &quot;near *&quot; from the C code at the bottom of page 502.

This information applies to Microsoft Basic Professional Development System (PDS) versions 7.00 and 7.10 for MS-DOS and MS OS/2.



Correction #1
The incorrect declaration on page 502 is as follows: DECLARE SUB AddString (SEG S1$,BYVAL S1Length,SEG S2$,BYVAL S2Length_                      OutString1$,OutString2$) OutString1$ and OutString2$ should be declared with the SEG attribute so that they are passed using far addressing. The corrected declaration is as follows: DECLARE SUB AddString (SEG S1$,BYVAL S1Length,SEG S2$,BYVAL S2Length_                         SEG OutString1$,SEG OutString2$)

Correction #2
The C function prototype reads as follows: void near * far pascal addstring( char far * s1, int s1len, char      far * s2, int s2len, char far * s3, char far * s4 ); This line should read: void far pascal addstring( char far *s1, int s1len, char      far * s2, int s2len, char far * s3, char far * s4 );

