www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/01/10/21:55:35

From: axlq AT unicorn DOT us DOT com (to comp.os.msdos.djgpp)
Newsgroups: comp.os.msdos.djgpp
Subject: Calling C++ functions from C functions: how?
Date: 11 Jan 1999 02:50:56 GMT
Organization: a2i network
Lines: 26
Message-ID: <77boug$l58$1@samba.rahul.net>
NNTP-Posting-Host: waltz.rahul.net
NNTP-Posting-User: unicorn
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

I have a library that contains several C modules and two C++ modules.
The C modules end in .c and the C++ modules end in .cc.  I'm using RHIDE
to build everything.  No special compiler options.

I also have a test program in C that calls these functions.

When I attempt to link my program to the library, the linker complains
that two functions called by the test program are undefined.  These two
functions happen to be the C++ ones in the library.

I'm trying to port a rather large application that uses mixed C and C++
functions, which compiled and ran fine under another compiler (ZTC).
But with DJGPP, I'm running into this problem with the linker.

Is there something I can do with a function prototype that tells the
compiler compiling a C module, "this function call is to a C++ function
in another module"?  It doesn't help to compile my test program as a C++
program, and invoking the compiler with -x c++ seems to corrupt
something in the object files.

I've been fighting this all day.  There has to be something simple I'm
just not seeing....

-Alex
If e-mail reply bounces, try alex at unicorn.us.com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019