delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/12/13/13:39:39

Message-ID: <3492D24C.A392551@gmx.net>
Date: Sat, 13 Dec 1997 19:22:04 +0100
From: Robert Hoehne <robert DOT hoehne AT gmx DOT net>
MIME-Version: 1.0
To: Mike McLean <libolt AT primenet DOT com>
CC: DJGPP Mailing list <djgpp AT delorie DOT com>
Subject: Re: C & C++ mixed?
References: <349215bb DOT 9779905 AT news DOT primenet DOT com> <34931a9a DOT 11027695 AT news DOT primenet DOT com>

Mike McLean schrieb:
> 
> // part from luth.h the header file
> 
> // Prototypes for File routines
> 
> void fileSave(void);
> 

Change this to:

#ifdef _cplusplus
extern "C"
#endif
void fileSave(void);

> // function in file.cpp
> 
> void fileSave(void)

and this to:

extern "C" void fileSave(void)


This is needed when you want to use functions from
C++ in C. For the header files you can use also the
trick (if you have more than one prototype)

#ifdef _cplusplus
extern "C" {
#endif

/* Now all you prototypes in the normal notation */

#ifdef _cplusplus
}
#endif


Robert
-- 
******************************************************
* email:   Robert Hoehne <robert DOT hoehne AT gmx DOT net>     *
* Post:    Am Berg 3, D-09573 Dittmannsdorf, Germany *
* WWW:     http://www.tu-chemnitz.de/~sho/rho        *
******************************************************


- Raw text -


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