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 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][2] and of exception handling. (e.g. C `longjmp` is not friendly with C++ exceptions). Dynamic loading facilities like [`dlopen`][3] and [`dlsym`][4] are relevant to name mangling. So prefer an API using `extern "C"` functions.

Memory management (notably with [garbage collection][5]) is also an issue. Study for examples [foreign function][6] interface [of Ocaml][7] and [of SBCL][8]. Look into [libffi][9].


  [1]: https://en.wikipedia.org/wiki/Application_binary_interface
  [2]: https://en.wikipedia.org/wiki/Name_mangling
  [3]: http://man7.org/linux/man-pages/man3/dlopen.3.html
  [4]: http://man7.org/linux/man-pages/man3/dlsym.3.html
  [5]: https://en.wikipedia.org/wiki/Garbage_collection_(computer_science)
  [6]: https://en.wikipedia.org/wiki/Foreign_function_interface
  [7]: http://caml.inria.fr/pub/docs/manual-ocaml/intfc.html
  [8]: http://sbcl.org/manual/index.html#Foreign-Function-Interface
  [9]: https://sourceware.org/libffi/