gengirish / protobuf-embedded-c

Automatically exported from code.google.com/p/protobuf-embedded-c
0 stars 0 forks source link

Allow C static library to be used from C++. #13

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Make a new proto
2. Compile proto
3. Compile code into a static C library
4. Link to the library from external C++ code.

What is the expected output? What do you see instead?
Should be able to call those functions in C++.  Instead get undefined reference 
errors.  This is due to C++ function mangling.  If the outputed code simply 
included 

extern "C" {
#endif
//
// put C function prototypes here
int somefunction(int);
// other function prototypes here

#ifdef _cplusplus // if compiled with C++ compiler
} // end of extern "C" block
#endif

This would fix the problem.

What version of the product are you using? On what operating system?
1.02M under Cygwin and Linux

Please provide any additional information below.

Original issue reported on code.google.com by rost0...@gmail.com on 24 Jul 2012 at 9:23

GoogleCodeExporter commented 8 years ago
Please close this issue. I submitted it before I thought.  Simply wrapping the 
#include with extern "C" { } works just fine.

Original comment by rost0...@gmail.com on 24 Jul 2012 at 9:31

GoogleCodeExporter commented 8 years ago
As said in the previous comment this does not need to be fixed.

Original comment by nvp...@gmail.com on 11 Dec 2012 at 10:17