如何从C ++调用C#和JAVA代码

如何从C ++调用C#和JAVA代码

问题描述:

我需要从C ++/C代码库调用C#和Java代码.
请告知相同的过程.

根据以下反馈确定一些更新:
我有具有C/C ++代码的dll.我正在尝试将不同的语言组件插入其中,这些组件在C#的dll中和JAVA的jar中.
我将需要调用这些组件函数.如果可以,我可以实现中间层.

I need to call C# and Java code from C++/C code base.
Please tell the process for the same.

OK some update based on feedback below:
I am having dll having C/C++ code. I am trying to plugin different language components into it, the components are in dll for C# and jar for JAVA.
I would need to call these component functions. I am ok with implementing intermediate layer if ie required.

要从C ++调用C#代码,您可以在C#中创建一个COM对象,然后从C ++或任何对象中调用它您想要的语言,或者可以通过IPC协议或套接字使用网络通信,甚至对于JAVA也是可能的.
To invoke C# code from C++ you can create a COM object in C# and then invoke it from C++ or any language you want, or you can use network communication by IPC protocol or using sockets, it will be possible even for JAVA.


您到底想做什么?这是Java和C#的源代码吗?它们是可执行文件(如果是Java,则是jar文件)吗?还是只是源文件?
What are you trying to do exactly ? Wherre is this java and C# coming from ? Are they executables (or jar files in case of java) ? Or simply source files ?