none
Call C# DLL From Java application RRS feed

  • Question

  • Is there a way to create a C# DLL (class library) with a method callable from a Java application? I mean C# only, not also writing C/C++ stuff. So can I decorate the method with an appropriate calling convention? The method will take a string as input and does not have to return anything. It will display a window with an image and return when they close the window.

    Thank you,


    Jon Jacobs, There are 10 kinds of people: those who understand binary and those who don't

    Friday, August 10, 2018 4:53 PM

Answers

  • The simpler way would be starting this as process and waiting til it quits. Otherwise, you may make this assembly COM+ compatible and interop with it.
    • Marked as answer by Jon Q Jacobs Tuesday, August 14, 2018 7:42 PM
    Sunday, August 12, 2018 12:55 PM

All replies

  • The simpler way would be starting this as process and waiting til it quits. Otherwise, you may make this assembly COM+ compatible and interop with it.
    • Marked as answer by Jon Q Jacobs Tuesday, August 14, 2018 7:42 PM
    Sunday, August 12, 2018 12:55 PM
  • Hi Jon,

    Please refer to the following documents:

    How to Wrap a C# Library for Use in Java

    Can i use .Net dll in Java?

    Regards,

    Stanly


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, August 13, 2018 2:36 AM
  • >The simpler way would be starting this as process and waiting til it quits.
    >Otherwise, you may make this assembly COM+ compatible and interop with it.

    Both of those ideas sound workable and I will explore them. Thank you.

    Jon Jacobs, There are 10 kinds of people: those who understand binary and those who don't

    Monday, August 13, 2018 1:08 PM
  • >Please refer to the following documents:
    Yes, I have looked into writing a C++ wrapper dll, but I want to avoid that if possible.
    However, I had glossed over the regasm approach, and I will give that another look.
    Thank you

    Jon Jacobs, There are 10 kinds of people: those who understand binary and those who don't

    Monday, August 13, 2018 1:09 PM
  • Hi Jon,

    In fact, according to your description, your issue is more related about Java application, it will be more appropriate to ask your question at Java Programming Forum.

    Thank you for your understanding.

    Regards,

    Stanly

    Note: This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; Therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, August 14, 2018 6:40 AM
  • Actually, I leave the details of the Java side to the Java programmers.

    My question is Purely C#. How to make it usable by the dark side.


    Jon Jacobs, There are 10 kinds of people: those who understand binary and those who don't

    Tuesday, August 14, 2018 7:45 PM