1

I'm currently developing a SDK for our product in C++. However, some of our customers have a code base written in C that will need to interface with our SDK. I need to provide C Interfaces and am looking for some references on how best to approach this.

I'm using the GNU compilers (version 4.6.3).

I am aware of the extern "C" {} construct and have used it sparingly, but I'm not really an expert with this.

daniel gratzer
  • 52,833
  • 11
  • 94
  • 134
tehwallz
  • 134
  • 9

1 Answers1

0

Here are my suggestions:

  1. Provide some C language interfaces or functions that use static C++ objects to invoke functionality.
  2. Add static functions to your classes for use with the C language.
  3. Change your design so that there are free standing functions that accept structures and classes.
  4. Also, don't overload free standing functions.
Thomas Matthews
  • 56,849
  • 17
  • 98
  • 154