• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

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

 
Ranch Hand
Posts: 502
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I haven't found a clear answer in the Internet.

 
author
Posts: 23958
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 502
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 23958
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Fire me boy! Cool, soothing, shameless self promotion:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic