See the question and my original answer on StackOverflow

If you need it to work across different OSes, you will have hard time doing it in a pretty generic manner. You can search for "platform independent APIs" in this wikipedia article: Inter-process communication to get an idea. Most of what you will find is heavyweight.

One simple way would be to write an ad-hoc HTTP REST server (possibly with JSON or XML as the interchange format). It has the advantage of being simple, and you will be able to access it using any OS with a decent HTTP stack (including mobiles).