You cannot do that because some languages implementations could have an [ABI][1] different and incompatible with the C one.

On current systems, C is very common and most (but not all) language implementations have an ABI and [calling conventions][2] compatible with the one from C. Notice that it is a property of the implementation (your C compiler and your operating system), not of the programming language.

If using C++, beware of [name mangling][3] and of exception handling. (e.g. C `longjmp` is not friendly with C++ exceptions). [Dynamic loading][4] facilities like [`dlopen`][5] and [`dlsym`][6] are relevant to name mangling. So prefer an API using `extern "C"` functions. [libgccjit][7] could be inspirational (it is coded in C++ but has a C friendly API) and perhaps useful (you could consider runtime generation of glue code).

Memory management (notably with [garbage collection][8]) is also an issue. Study for examples [foreign function][9] interface [of Ocaml][10] and [of SBCL][11] and [of Lua][12] and of [Guile][13]. Look into [libffi][14].

You could provide some reflection facilities (e.g an API to query your API, e.g. like [GTK introspection][15]). You might try to provide a generic closure mechanism like [in  GObject][16]-s.

You could use (or customize or adapt) code generators like [SWIG][17]. You might consider compiler plugins (e.g. [GCC MELT][18] extensions).

## There is [**no silver bullet**][19].



<sup>NB. Better make your stuff [free software][20]. You might get outside contributions.</sup>


  [1]: https://en.wikipedia.org/wiki/Application_binary_interface
  [2]: https://en.wikipedia.org/wiki/Calling_convention
  [3]: https://en.wikipedia.org/wiki/Name_mangling
  [4]: https://en.wikipedia.org/wiki/Dynamic_loading
  [5]: http://man7.org/linux/man-pages/man3/dlopen.3.html
  [6]: http://man7.org/linux/man-pages/man3/dlsym.3.html
  [7]: https://gcc.gnu.org/onlinedocs/jit/
  [8]: https://en.wikipedia.org/wiki/Garbage_collection_(computer_science)
  [9]: https://en.wikipedia.org/wiki/Foreign_function_interface
  [10]: http://caml.inria.fr/pub/docs/manual-ocaml/intfc.html
  [11]: http://sbcl.org/manual/index.html#Foreign-Function-Interface
  [12]: https://www.lua.org/manual/5.3/manual.html#4
  [13]: https://www.gnu.org/software/guile/learn/
  [14]: https://sourceware.org/libffi/
  [15]: https://wiki.gnome.org/Projects/GObjectIntrospection
  [16]: https://developer.gnome.org/gobject/stable/gobject-Closures.html
  [17]: http://swig.org/
  [18]: http://gcc-melt.org/
  [19]: https://en.wikipedia.org/wiki/No_Silver_Bullet
  [20]: https://en.wikipedia.org/wiki/Free_software