When to use a .C library vs a .CPP library

I am copying the wiring_serial library for testing. I want to create a new "test_serial" with my mods. Hopefully that avoids the risks of continuing to edit the core code.

My question is, HardwareSerial.cpp appears to simply call "wiring.serial.c" presumably to put a C++ face on it. Is there any reason I cannot make my new library a .CPP to start with? It looks like you can hook interrupts in .CPP. Or for that matter is there any problem with creating a .C library and distributing it?

Feel free to make libraries written in C++. I think the existing libraries don't go all out and make it all C++ so that the syntax is slightly less confusing for newcomers or C programmers, but C++ can really serve the needs of small programs just as well as C.

If you're going to make C library functions usable from a user's C++ sketch, you just need to ensure that your header file is explicit about its C nature.

MyLibraryWrittenInC.h

[glow]#ifdef __cplusplus
extern C {
#endif[/glow]

/* prototypes for functions implemented in C */
int myCfunction(float, char, int);

[glow]#ifdef __cplusplus
} // extern C
#endif[/glow]

Thanks - thats just what I needed. I didnt understand th C header.