473,324 Members | 1,678 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

how to interface between different languages

Hello,
I need to write some C++ code that can be later invoked by another
program that is written in a different lanuage (it can be Java, Perl,
etc. I don't know ahead of time). How can I interface my C++ program
and the other program if I don't want to write a wrapper for every
single language ?

I need to pass a pointer between the C++ program and the other program.

Thank you in advance!
Eddy

Jan 9 '06 #1
5 1924

<ed********@hotmail.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
Hello,
I need to write some C++ code that can be later invoked by another
program that is written in a different lanuage (it can be Java, Perl,
etc. I don't know ahead of time). How can I interface my C++ program
and the other program if I don't want to write a wrapper for every
single language ?

I need to pass a pointer between the C++ program and the other program.


Standard C++ only provides an 'interface' with one other language: C.
Look up "extern C" in a C++ book.(*) Interfacing with any other languages
will be platform specific operations. Check documentation for the langauge
translators (and possibly operating systems) in which you're interested.

(*) incompatibilities among translators can still give
unexpected results. I recommend only using translators
whose vendors specifically state will work together
correctly.

-Mike
Jan 10 '06 #2
Thank you everyoney for the information!
Eddy

Jan 10 '06 #3
This is a whole subject in and of itself, there is no simple way.

Probably the method closest to the way you describe your requirements
is to use CORBA, and there are many great C++ implementations, for
example omniORB.

http://omniorb.sourceforge.net/

Other solutions - XML-RPC, MOMs, SOAP, etc etc to give you some search
keys.

Jan 10 '06 #4
"Interfacing with any other languages will be platform specific
operations. Check documentation for the langauge translators (and
possibly operating systems) in which you're interested. "

Yes, using that solution would be plaform specific, and yes, that would
be a mess (although surely folks have done it), and that's why folks
came up with standards like CORBA, which hide all those messy details,
to an extent, so people don't have to reinvent the wheel.

And with open-source projects like omniORB, if you can compile a C++
program on your platform, you should be set.

http://omniorb.sourceforge.net/

Jan 10 '06 #5
ed********@hotmail.com wrote:
Hello,
I need to write some C++ code that can be later invoked by another
program that is written in a different language (it can be Java, Perl,
etc. I don't know ahead of time). How can I interface my C++ program
and the other program if I don't want to write a wrapper for every
single language ?
It's unfortunate that there's no standard interface to other languages.
I've always wanted to write a unified wrapper for all languages that
interface with C/C++, but I have never gotten around to doing it.
I need to pass a pointer between the C++ program and the other program.
Either the language/C interface has a "pointer" type, or you could
convert it to an int. However it would be an opaque pointer, similar to
a void*. But if the language passed you the pointer back, you could
cast it back to the right type.
Thank you in advance!
Eddy

Jan 11 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Anon Email | last post by:
Hi people, I'm learning about header files in C++. The following is code from Bartosz Milewski: // Code const int maxStack = 16; class IStack
3
by: Pol Bawin | last post by:
A class has a private field of type IWizard (An interface) and a public property to access it. When I try to serialize the Geometry class in XML, i have an error but it works in Binary Can...
6
by: Sgt. Sausage | last post by:
I know it's not possible, but I need a protected internal interface: protected internal interface ISomeInterface{ // yadda yadda yadda } Basically, I need an interface that is completely...
21
by: Helge Jensen | last post by:
I've got some data that has Set structure, that is membership, insert and delete is fast (O(1), hashing). I can't find a System.Collections interface that matches the operations naturally offered...
6
by: John Salerno | last post by:
I understand how they work (basically), but I think maybe the examples I'm reading are too elementary to really show their value. Here's one from Programming C#: #region Using directives ...
4
by: Ray Dukes | last post by:
What I am looking to do is map the implementation of interface properties and functions to an inherited method of the base class. Please see below. ...
9
by: Chris Dunaway | last post by:
I have created an Interface called IClientModule in a class libarary and have compiled the library to a .dll. In my main app, I scan a folder for .dll's and load each one that implements the...
17
by: Zytan | last post by:
Aren't all classes interfaces? What constitutes an interface (and with it, the "I" prefix distinction)? Zytan
15
by: Xah Lee | last post by:
On Java's Interface Xah Lee, 20050223 In Java the language, there's this a keyword “interface”. In a functional language, a function can be specified by its name and parameter specs....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, youll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.