[gmpi] Re: calling C from C++

  • From: David Olofson <david@xxxxxxxxxxx>
  • To: gmpi@xxxxxxxxxxxxx
  • Date: Mon, 14 Feb 2005 01:24:38 +0100

On Monday 14 February 2005 00.46, Jeff McClintock wrote:
>  > oh yeah, can we clean this up to something like:
> <snip>
> 
> Cheers Tim, done.
> 
> next question...
> 
> extern "C" somefunction();
> 
> is that standard C?

No, but it's standard C++...


> (MSC++ needs it to call a C function from C++)

Goes for all C++ compilers I know of (name mangling, if nothing else) 
- which is why you #ifdef it like this in C headers that are to be 
used with C++:

#ifdef __cplusplus
extern "C" {
#endif
...
<C stuff>
...
#ifdef __cplusplus
};
#endif


//David Olofson - Programmer, Composer, Open Source Advocate

.- Audiality -----------------------------------------------.
|  Free/Open Source audio engine for games and multimedia.  |
| MIDI, modular synthesis, real time effects, scripting,... |
`-----------------------------------> http://audiality.org -'
   --- http://olofson.net --- http://www.reologica.se ---

----------------------------------------------------------------------
Generalized Music Plugin Interface (GMPI) public discussion list
Participation in this list is contingent upon your abiding by the
following rules:  Please stay on topic.  You are responsible for your own
words.  Please respect your fellow subscribers.  Please do not
redistribute anyone else's words without their permission.

Archive: //www.freelists.org/archives/gmpi
Email gmpi-request@xxxxxxxxxxxxx w/ subject "unsubscribe" to unsubscribe

Other related posts: