Baboon
Baboon

Reputation: 307

How does a program use files written in different languages?

I was looking at the teamviewer source yesterday

(http://web.archive.org/web/20060412051941/http://download.teamviewer.com/download/TeamViewer_Source.zip)

and i notice that it had files written in different programming languages (java and c, ect). So basically, i'm wondering how a program (like teamviewer) is able to use files written in different languages. Do i need a certain kind of tool that can combine the different languages together?

Upvotes: 1

Views: 668

Answers (1)

Mike Nakis
Mike Nakis

Reputation: 62054

Ususally each language offers some means of interfacing with other languages. For example Java supports the native keyword which you can use to describe a method which is written not in Java, but in some other language. Search the Java files for the word "native" and I am pretty sure you will find some methods. Then, if you look into the C files, you will see that these methods are implemented there. Of course languages run within runtime environments, and every such environment must also provide runtime support for mixing modules written in different languages. In the Java world there is something called the Java Native Interface (JNI) for this task.

If you want details on how to actually write a program in Java and C, a search for "JNI" would be a good starting point.

Upvotes: 2

Related Questions