Basic PDS Manual Correction Passing Far Strings to C (70666)



The information in this article applies to:

  • Microsoft Basic Professional Development System (PDS) for MS-DOS and MS OS/2 7.0
  • Microsoft Basic Professional Development System (PDS) for MS-DOS and MS OS/2 7.1

This article was previously published under Q70666

SUMMARY

Page 502 of the "Microsoft Basic 7.0: Programmer's Guide" (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 "near *" 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.

MORE INFORMATION

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 );
				

REFERENCES

For more information about calling C from Basic, search for separate articles by using the following query:

BAS2C


Modification Type:MajorLast Reviewed:10/20/2003
Keywords:KB70666