www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/10/15/09:46:55

Xref: news-dnh.mv.net comp.os.msdos.djgpp:2668
Path: news-dnh.mv.net!mv!news.sprintlink.net!hookup!usenet.eel.ufl.edu!newsfeed.internetmci.com!news.msfc.nasa.gov!elroy.jpl.nasa.gov!decwrl!genmagic!goonsquad.spies.com!uuwest!alcyone!max
From: max AT alcyone DOT darkside DOT com (Erik Max Francis)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: silly C & C++ linking
Date: Fri, 13 Oct 95 14:29:57 PDT
References: <DGE79A DOT 6Jz AT jade DOT mv DOT net>
Organization: &tSftDotIotE
Lines: 32
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Dj-Gateway: from newsgroup comp.os.msdos.djgpp

rgoleb AT et DOT put DOT poznan DOT pl writes:

> It would ask anyone rather a silly question 
> 
> How to link the files one name1.cc (C++ compilation) and another name2.c
>   (C compilation - taken from my library) (I have no time to convert all
>   my functions). The linker tells alveys about undefined references in C++ 
>   file defined in fact.

I'm not sure exactly what you're saying, but it sounds like you're 
trying to have C++ functions call C functions.  This doesn't happen 
naturally, since C++ is in actuality a different language than C.

What you have to do is use the extern "C" notation (this is draft 
standard, so it's okay) to accomplish your goal.

In name1.cc, use

extern "C" {
#include "name2.h"
}

or the functional equivalent of whatever you're doing to link C++ with 
C code.

If this isn't what you meant, let me know.


Erik Max Francis, &tSftDotIotE // uuwest!alcyone!max, max AT alcyone DOT darkside DOT com
San Jose, CA, USA // 37 20 07 N  121 53 38 W // GIGO, Omega, Psi // the 4th R!
H.3`S,3,P,3$S,#$Q,C`Q,3,P,3$S,#$Q,3`Q,3,P,C$Q,#(Q.#`-"C`- // 1love // folasade
_Omnia quia sunt, lumina sunt._ // mc2? oo?  Nah. // http://www.spies.com/max/

- Raw text -


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