Programming language interoperability

There are a ton of programming languages in our world. If you’re a developer, I think you may know a few. C#, JAVA, C++ or whatever

I used to develop programs in C#. I used to learn JAVA. I learned C from the beginning to understand what is programming. I’ve been working on Objective-C, Swift so far. Sometimes, I wonder why We have invented so many programming languages? Can they work together rather than just dedicated to a specific platform, specific purpose?

If you used to use Objective-C, then you actually can mix the code with C/C++. Swift can import Objective-C and vice versa, of course.

Can Android code call C/C++ API?

How does Xamarin implement its cross-platform SDK? How does it make access to iOS native API or Android native API?

I don’t have an insight. Theoretically, I think there are some possibilities. I did some research and I see there are some ways. It can be tough to do. They can be something I don’t usually daily.

I have made up a map to show how programming languages interact together.

Languages interoperabilities
Programming language interoperability

Most of some programming languages which are presented in the map, they relate somehow to mobile development. A few languages, I have known a lot or a bit.

The most interesting thing is somehow all programming languages are able to interact with C/C++ at least in one-way. Look like everyone loves C/C++.

JAVA, C#, Mono, Swift, Dart, and Objective-C, they all can talk to C/C++ in some certain ways.

Conclusion

C/C++ is like a bridge so Mono can talk Objective-C, Swift through C/C++ wrapper? Swift can access Android API through C/C++, etc?

So far I haven’t done anything to prove it, but I hope it is true. If I’m wrong or miss anything, please correct me. Lol

References

Call Swift From C/C++ By use @_silgen_name
Dart vs. C/C++
Call C# from C++/CLR
Call C++/CLR from C#
C# import C++ DLL
C# call C by delegate function
Call C from x86 Assembly
Call C from ARM Assembly
C/C++ Wrapper
SWIG, Wrapper tool for C/C++
C# call c by delegate function

P/s: There are a ton of programming languages out there. However, I’m not able to cover them all in this post. If you’re curious, then take a look at SWIG. It’s a software development tool that connects programs written in C and C++ with a variety of high-level programming languages (Tcl, Python, Perl, Guile, Java, Ruby, Mzscheme, PHP, Ocaml, Pike, C#, Chicken, Allegro CL, Modula-3, Lua, CLISP and Common Lisp with UFFI, Common Lisp with CFFI, R, Octave, Go lang, D, Javascript, Scilab). But I really know these, so don’t ask me.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s