473,406 Members | 2,217 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,406 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 1926

<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....
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.