D
Danny
Hi all,
I would like to write C++ code and call
it from VBDOS, or even QB 4.5 or PDS 7.1,
including plain-type parameter passing.
My C/C++ compiler is MS-C/C++ v8.00c,
and I have VBDOS v1.00, PDS v7.1,
and QuickBASIC v4.5.
I also have MASM v6.11, if that helps;
when I tried the MASM/VBDOS example,
it worked ok.
I took the C example program from VBDOS's
online Help System, but the C/C++
compiler gave me some error messages.
Could any one please tell me how to
fix this?
Thanks in advance,
Danny.
The files are:
==============
1. STDIO.H - which was present in the same directory.
--------------------------------------------------
2. The C program:
-----------------
#include <stdio.h>
struct common_block { // Structure that looks like the Basic
int a; // common block.
char b[20];
float c;
};
void RCommon(struct common_block far *pointer) {
printf("Element1 = %d\", pointer->a);
printf("Element2 = %Fs\", pointer->b);
printf("Element3 = %f\", pointer->c);
}
--------------------------------------------------
3. The BASIC program:
---------------------
DECLARE SUB RCommon CDECL (_
BYVAL p1o AS INTEGER,_
BYVAL p1s AS INTEGER)
COMMON SHARED element1 AS INTEGER, element2 AS STRING * 20,_
element3 AS SINGLE
element1 = 23
element2 = "DATE : " + DATE$ + CHR$(0)
element3 = 309.03
CALL RCommon(VARPTR(element1), VARSEG(element1))
END
--------------------------------------------------
4. The Command-Line Arguments for the C/C++ Compiler:
-----------------------------------------------------
CL.EXE -c -AM CMODULE.C
--------------------------------------------------
5. The Error Messages given by the C/C++ Compiler:
--------------------------------------------------
cmodule.c
cmodule.c(10) : error C2001: newline in constant
cmodule.c(11) : error C2146: syntax error : missing ')' before identifier 'printf'
cmodule.c(11) : error C2001: newline in constant
cmodule.c(12) : error C2001: newline in constant
I would like to write C++ code and call
it from VBDOS, or even QB 4.5 or PDS 7.1,
including plain-type parameter passing.
My C/C++ compiler is MS-C/C++ v8.00c,
and I have VBDOS v1.00, PDS v7.1,
and QuickBASIC v4.5.
I also have MASM v6.11, if that helps;
when I tried the MASM/VBDOS example,
it worked ok.
I took the C example program from VBDOS's
online Help System, but the C/C++
compiler gave me some error messages.
Could any one please tell me how to
fix this?
Thanks in advance,
Danny.
The files are:
==============
1. STDIO.H - which was present in the same directory.
--------------------------------------------------
2. The C program:
-----------------
#include <stdio.h>
struct common_block { // Structure that looks like the Basic
int a; // common block.
char b[20];
float c;
};
void RCommon(struct common_block far *pointer) {
printf("Element1 = %d\", pointer->a);
printf("Element2 = %Fs\", pointer->b);
printf("Element3 = %f\", pointer->c);
}
--------------------------------------------------
3. The BASIC program:
---------------------
DECLARE SUB RCommon CDECL (_
BYVAL p1o AS INTEGER,_
BYVAL p1s AS INTEGER)
COMMON SHARED element1 AS INTEGER, element2 AS STRING * 20,_
element3 AS SINGLE
element1 = 23
element2 = "DATE : " + DATE$ + CHR$(0)
element3 = 309.03
CALL RCommon(VARPTR(element1), VARSEG(element1))
END
--------------------------------------------------
4. The Command-Line Arguments for the C/C++ Compiler:
-----------------------------------------------------
CL.EXE -c -AM CMODULE.C
--------------------------------------------------
5. The Error Messages given by the C/C++ Compiler:
--------------------------------------------------
cmodule.c
cmodule.c(10) : error C2001: newline in constant
cmodule.c(11) : error C2146: syntax error : missing ')' before identifier 'printf'
cmodule.c(11) : error C2001: newline in constant
cmodule.c(12) : error C2001: newline in constant