From: spratte@odette.cxo.dec.com (Michael Spratte)
Subject: Re: How can you call C++ code from C code, using "DEC C" & "DEC C++ V1.3B"
Date: 1995/08/10 [thread overview]
Message-ID: <40dnel$bje@nntpd2.cxo.dec.com> (raw)
In-Reply-To: 40br6e$knf@merlin.resmel.bhp.com.au
In article <40br6e$knf@merlin.resmel.bhp.com.au>, Joe Spanicek,BHP-Research PKL,, <joe@holly.resptk.bhp.com.au> writes:
|>Hi,
|>
|>I have OSF/1 V3.0 using "DEC C" & "DEC C++ V1.3B". The problem I am having is
|>calling a archive compiled with 'C++' from with C code witch is compiled with
|>'C'.
|>
|>The problem lies with linking the archive library to the generated C code. The
|>C++ compiler produces object code with a 'name' reference to functions
|>differently than does the C compiler. So in the end the linker can not make
|>the connection between the functions.
|>
|>Could anyone give pointers on how to get around this, I am fluent in C but just
|>started in C++. I am trying to use a library written in C++ within software
|>written only in C.
|>
Declare swapme in function.cc as `extern "C"':
#include <stdio.h>
extern "C" void // <<----------------------------------------------
swapme(int *p, int *q)
{
printf("in swapme: %d %d\n", *p, *q);
int t = *p;
*p = *q;
*q = t;
}
Michael Spratte
DSNlink Engineering
Digital Equipment Corporation
Colorado Springs, Colorado
prev parent reply other threads:[~1995-08-10 4:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1995-08-10 4:00 How can you call C++ code from C code, using "DEC C" & "DEC C++ V1.3B" Joe
1995-08-10 4:00 ` Michael Spratte [this message]
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox