Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Examples of C interfaces to C++ libraries?

Tags:

c++

c

I'm in the process of writing a C interface to a C++ library, and I'm looking for some high-quality examples (or best practices).

So far this one seems pretty promising: http://czmq.zeromq.org/manual:czmq

Any other suggestions?

like image 281
jjkparker Avatar asked Nov 04 '11 11:11

jjkparker


People also ask

What is c interface?

C Interfaces and Implementations shows how to create reusable APIs using interface-based design, a language-independent methodology that separates interfaces from their implementations. This methodology is explained by example.

Can you use libraries in C?

Functions in a C library can be used and accessed by programmers to create several different programs. As a programmer, you may find yourself using the same function or functions repeatedly. In this case, it is best to put this function or functions in a library to speed up the compilation of the program.


2 Answers

You could look into the Parma Polyhedra Library as an example of excellent C interface to a well written C++ library. PPL is a free GPL-ed software, notably used inside the GCC compiler.

like image 134
Basile Starynkevitch Avatar answered Oct 16 '22 12:10

Basile Starynkevitch


Another high quality example is the Open Dynamics Engine. It has a C++ backend and a C frontend. Everything is C linkable.

  • C++ example
  • C example
like image 37
w177us Avatar answered Oct 16 '22 13:10

w177us