• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How do I run methods in .Net objects (C#, VB, etc)

 
Alejandro Barrero
Ranch Hand
Posts: 351
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I haven't found a clear answer in the Internet.

 
Henry Wong
author
Marshal
Pie
Posts: 21419
84
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Alejandro Barrero wrote:I haven't found a clear answer in the Internet.


.NET languages can call methods of .NET objects, regardless of what language the .NET objects are developed in.

In the case of Java, and I am assuming you are trying to do it from java, one possibly is to use JNI. JNI will enable java to call C/C++ wrappers, which can then be used to get to .NET. From C++, the easiest path to .NET is probably to managed C++, as managed C++ is a .NET language, and the Microsoft compiler can compile code with both managed (for .NET) and unmanaged (for JNI) components.

Henry
 
Alejandro Barrero
Ranch Hand
Posts: 351
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much for your prompt reply. I have learned that I can execute functions in another language using JNDI and I have also been reading about JNA. I understand that I can execute functions from a DLL or a lib and I could probably code to that; but I am faced with a situation where I have to execute a method from an instance of an object and I am at a loss.
 
Henry Wong
author
Marshal
Pie
Posts: 21419
84
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Alejandro Barrero wrote:Thank you very much for your prompt reply. I have learned that I can execute functions in another language using JNDI and I have also been reading about JNA. I understand that I can execute functions from a DLL or a lib and I could probably code to that; but I am faced with a situation where I have to execute a method from an instance of an object and I am at a loss.


First, I don't think that JNDI is an option here. JNDI is used to get object stubs for application server objects, or services (such as CORBA) objects. I don't think that there is an implementation of JNDI that will return object stubs for .NET components. I may be wrong here, so feel free to examine some more -- but I don't know of such an implementation.

As for JNI (and maybe JNA), these are low level libraries that get you from Java to another language. With this, you can get to what you want, however, you need to implement wrapper stuff. In other words, you need to implement your own object stubs.

Henry
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic