简体   繁体   English

使用CORBA和C ++和Java的IPC

[英]IPC using CORBA with C++ and Java

I am decided to use CORBA to communicate between a C++ service and a java service. 我决定使用CORBA在C ++服务和Java服务之间进行通信。 I want to know that is it possible using CORBA to inter call C++ library and java library like we call a dll in an application. 我想知道使用CORBA可以像在应用程序中调用dll那样相互调用C ++库和Java库。 It will be very helpful if anyone help me to take a good decision! 如果有人帮助我做出明智的决定,这将非常有帮助!

(Seems some confusion in my previous answer. I think it is better that I give another answer which state clearer my point) (我之前的回答似乎有些混乱。我认为最好再给出一个更清楚我的观点的答案)

CORBA is for interactions between "remote" components. CORBA用于“远程”组件之间的交互。 Although I used the term "Remote" here, it doesn't mean that components needs to be located in remote machine. 尽管我在这里使用了“远程”一词,但这并不意味着组件需要位于远程计算机中。 They can be in the same machine, or even same process. 它们可以在同一台机器上,甚至可以在同一进程中。

The answer mostly depends on your aim: 答案主要取决于您的目标:

If you are writing new libraries/components in C++ and Java, and you want to use them in the same application and have components in both language able to interact with each other, then yes, CORBA can help you in certain extend. 如果您要用C ++和Java编写新的库/组件,并且希望在同一应用程序中使用它们,并且两种语言的组件都能够相互交互,那么可以,CORBA可以在一定程度上帮助您。 However CORBA is helping you in the component communication part. 但是,CORBA会在组件通信部分为您提供帮助。 You still need to use JNI (or other similar solutions) to invoke/startup your C++/Java component in your Java/C++ application. 您仍然需要使用JNI(或其他类似的解决方案)来调用/启动Java / C ++应用程序中的C ++ / Java组件。 CORBA is not going to help you on this. CORBA不会为此提供帮助。 You may want to do extra POC to see if having two ORBs in same application (one for C++, one for Java) is going to cause you any problem. 您可能需要额外的POC,以查看在同一应用程序中是否有两个ORB(一个用于C ++,一个用于Java)会给您带来任何问题。

If you are talking about: you already have some existing libraries which is written in Java and C++ (of course, not in CORBA-awared manner), and you are looking for way to make use of these library in your new application (in Java/C++). 如果您在谈论:您已经拥有一些用Java和C ++编写的现有库(当然,不是以CORBA唤醒的方式),并且您正在寻找在新应用程序中使用这些库的方法(在Java中) / C ++)。 Then no, CORBA cannot help you much on this. 那不,CORBA在这方面不能为您提供太大帮助。 Of course you can still write a extra layer which expose your components in CORBA, and make use of them, but making use of CORBA here is not going to make "calling C++ library or Java library" anything easier. 当然,您仍然可以编写一个额外的层,以在CORBA中公开您的组件并加以利用,但是在这里使用CORBA不会使“调用C ++库或Java库”变得更加容易。

However, imho, neither case above seems to be a strong reason to make use of CORBA. 但是,恕我直言,上述两种情况似乎都不是使用CORBA的强烈理由。 If you are just looking for interoperability of Java and C++ libraries, JNI , or JNA maybe something you want to look into. 如果您只是在寻找Java和C ++库, JNIJNA的互操作性,那么您可能想研究一下。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM