Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Urgent C++/C integration problam

Posted on 1998-06-05
3
Medium Priority
?
180 Views
Last Modified: 2010-04-01
i am working with visual c++ ver 1.52 , and some of the files are c files (working with specific DCB ) and one file is a c++ file ( handeling io with files ).
while linking i get the folowing error

INIT.OBJ(c:\project\set\init.cpp) : error L2029: 'int __far __pascal VCC_Open(char __far*)' : unresolved external

where this function is declared in the c files like this :
int FAR PASCAL      VCC_Open( LPSTR szDevice );

what should i do to correct this error message ???
0
Comment
Question by:sector
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
3 Comments
 
LVL 22

Accepted Solution

by:
nietod earned 40 total points
ID: 1165303
answer coming.
0
 
LVL 22

Expert Comment

by:nietod
ID: 1165304
I'm assuming that this procedure is defined in one of the C files and that the C++ file "sees" external declaration for it.  Correct?  If so, the problem is name decoration.  C++ thinks that the function is a C++ function so the linker is looking for a function with a decorated name, but the function produced by C is not decorated so the linker cannot find the decorated name.  

The solution is to make C++ use a non-decorated name.  This is done using extern "C"  For example, declare the function in C++ like

extern "C" int FAR PASCAL VCC_Open( LPSTR szDevice );

Note that C does not recognize the extern "C" modifier.  so you must use a seperate declaration for the C and C++ files or you must use the preprocessor to produce the correct code for each case.
0
 
LVL 22

Expert Comment

by:nietod
ID: 1165305
Was this of any help?
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
Suggested Courses

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question