473,396 Members | 2,030 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Mixed-Language Programming : Ms-VBDOS v1.00 and Ms-C/C++ v8.00c

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
Jul 19 '05 #1
3 2572

"Danny" <da*******@yahoo.com> wrote in message
news:fc**************************@posting.google.c om...
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,
That compiler is almost prehistoric.
and I have VBDOS v1.00, PDS v7.1,
and QuickBASIC v4.5.

[snip]

void RCommon(struct common_block far *pointer) {
printf("Element1 = %d\", pointer->a);
printf("Element2 = %Fs\", pointer->b);
printf("Element3 = %f\", pointer->c);


Drop the backslashes, don't know why you think you need them

printf("Element1 = %d", pointer->a);
printf("Element2 = %Fs", pointer->b);
printf("Element3 = %f", pointer->c);

Might be an idea to learn some C++ (or C) before going much further,

john
Jul 19 '05 #2
> printf("Element1 = %d\", pointer->a);
printf("Element2 = %Fs\", pointer->b);
printf("Element3 = %f\", pointer->c);


Should be something like

printf("Element1 = %d\n", pointer->a);
printf("Element2 = %Fs\n", pointer->b);
printf("Element3 = %f\n", pointer->c);

"\n" is a single character in C and C++ and means newline. The backslash is
the escape character. It means that the 2nd character afterwards is
interpreted differently and the pair of them are 1 character. FYI, a small
table is

\a - alert CHR$(7)
\b - backspace CHR$(8)
\t - tab CHR$(9)
\n - newline CHR$(10)
\v - vertical tab CHR$(11)
\f - form feed CHR$(12)
\r - return CHR$(13)
\\ - single backslash
\" - double quote
\' - single quote

Stephen Howe
Jul 19 '05 #3
Danny wrote:
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.


This group is for discussion of the C++ language as defined by the
ANSI/ISO C++ Standard. That language does not define any kind of
interface to any other language (except C, sort of). In other words, the
only answer we can give to your question is, "You can't do that in C++."

You could try asking in a group that deals with the tools you are using.

-Kevin
--
My email address is valid, but changes periodically.
To contact me please use the address from a recent posting.

Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Perttu Pulkkinen | last post by:
No questions, but just consider if this is useful to you:-) but of course feedback & corrections are welcome. function php_mixed_to_js_value($jsname, $mixed) { if(is_null($mixed)) { return "\n...
2
by: Paul A. Hoadley | last post by:
Hello, I am trying to convert a RELAX NG schema to DTD using Trang. I am currently trying to add some inline elements to the schema, such as <emph> for marking emphasised text. Here is an...
15
by: Bill Cohagan | last post by:
I'm trying to generate class definitions from an XSD that contains something like: <xs:complexType name="foo" mixed="true"> <xs:choice minOccurs = "0" maxOccurs="unbounded"> <xs:element name =...
8
by: Bern McCarty | last post by:
Is it at all possible to leverage mixed-mode assemblies from AppDomains other than the default AppDomain? Is there any means at all of doing this? Mixed-mode is incredibly convenient, but if I...
7
by: Staale L. Hansen | last post by:
We have an application which uses some mixed-mode code to expose a .NET 1.1 managed API. Only the necessary files are compiled with /clr. We want to be able to load the application without .NET...
0
by: samsonfr | last post by:
Hello, I have read KB 814472 and the article "How To: Remove Dependency on _vcclrit.h" (http://msdn2.microsoft.com/en-us/library/ms173267(en-us,vs.80).aspx) which confirmed that VS.NET 2005...
3
by: Mali Guven | last post by:
Hello, I have a native DLL (written in C) which is supposed to call a managed DLL (was written in C#, and an entry point was injected modifying the ildasm'd code). The exectuable calls the...
0
by: emu | last post by:
Hi All, I have an unmanaged C++ application that references a mixed mode image DLL (mixed managed and unmanaged). Under .NET 1.1 we could trust the dll (the mixed mode dll) by running the...
1
by: andrew_nuss | last post by:
Hi, Lets say I have a MIXED tag in my XML DTD with content that is going to be rendered as HMTL, as well as a <boldand <italicstag. What about whitespace? Specifically, does the whitespace in...
1
by: =?Utf-8?B?SmltIFdhbHNo?= | last post by:
I have an VC++ MFC Win32 application that isn't working correctly when I build it with VS2005. The problem seems to be in some ADO ActiveX controls that came with VS6 and are now out of support....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.