How do programs of different languages interact? (If at all)

I've taken courses where they teach you programming languages much none address how programs of different languages interact.

Is it the case that you'll either have a complete program running in Java or C or C++ or HTML, Javascript, Matlab etc... or is there some way to communicate information between languages?

Where do you typically learn how to integrate different languages into a system?

Are there languages that can't be integrated?

Answers

  • Hey Elusive,

    I've used the OSC library to successfully communicate between C and my Processing apps. I believe most of the the major languages have ways to send and receive OSC data.

    Here's a tutorial: http://learning.codasign.com/index.php?title=Sending_and_Receiving_OSC_Data_Using_Processing

    hope this helps! ak

  • If you allow me to be pedantic, HTML is no a programming language (in the sense of having variables, conditions, loops...), but a markup language (the ML part), like XML or Json. It is a description of data, not processing of data.

    To answer the question, most languages also define "interop", ie. a way to interoperate with at least a base (or native) language.

    Java is able to interact with native C code, via JNI or JNA.
    Lot of JVM-based languages (Groovy, Scala, Ceylon, JRuby and other JXxx declinations of other languages) offer a way to interact with Java, allowing to access the huge amount of libraries in this language.
    JavaScript can interact with a Java applet and reciprocally (applets are out of fashion today, but it is still a good example).
    Interpreted languages like Ruby or Python or Lua have whole manual sections describing how to extend them in C (or C++) or to use C/C++ libraries, etc.

    And, as akiersky said, if what you want is communication between full programs, you can use sockets or shared files or similar techniques.

Sign In or Register to comment.