Thread: Combining Languages?

  1. #1
    Registered User
    Join Date
    Jul 2007
    Location
    Texas
    Posts
    103

    Combining Languages?

    Okay, I haven't been on here in a while due to my busy busy schedule, but seeing as how it's spring break, why not learn something new and useful. Okay, so I don't know if this is A LOT more complicated than I am making it out to be, but I see online that these programs are written in C and C++ or C and python or C and java or whatever it is. My question is how do you combine programming languages, like If I want to make a program out of C and Java? I am talking simple programs to start off, nothing fancy. So if you could help or point me in the right direction I would appreciate it a lot.

    Thanks a lot

  2. #2
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Combining languages are not always easy because most of them were not made to be interoperable. It would help if you specified what languages you are trying to interop first, and what exactly you're trying to achieve too.
    An don't expect it to go smoothly. The best is to stick with one language.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  3. #3
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    My question is how do you combine programming languages, like If I want to make a program out of C and Java?
    In the case of C and Java, you can use the Java Native Interface.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  4. #4
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Python has a C interface. It's not entirely trivial to use, but it certainly can be done.

    The trouble with almost all "combining" of languages is that the internal data structures and data formats need to match between one and the other. Since most higher level languages (these days) are based on C or C++, it's usually possible to get some sort of interface to C - how accessible and flexible this interface is will vary depending on the language.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  5. #5
    Registered User
    Join Date
    Jul 2007
    Location
    Texas
    Posts
    103
    Okay, thanks guys :]

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Why C Matters
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 136
    Last Post: 01-16-2008, 09:09 AM
  2. Strange loop
    By D@rk_force in forum C++ Programming
    Replies: 22
    Last Post: 12-18-2004, 02:40 PM
  3. Languages dying
    By Zewu in forum A Brief History of Cprogramming.com
    Replies: 31
    Last Post: 07-29-2003, 10:08 AM
  4. Programming Languages
    By DarkViper in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 12-12-2002, 02:28 PM
  5. Combining different languages
    By MethodMan in forum A Brief History of Cprogramming.com
    Replies: 9
    Last Post: 10-05-2002, 05:56 AM